diff --git a/go.md b/go.md index a0c66e56c00..32a83df392b 100644 --- a/go.md +++ b/go.md @@ -460,10 +460,10 @@ flowchart LR click chainlink/devenv href "https://github.com/smartcontractkit/chainlink" chainlink/devenv/fakes --> chainlink-testing-framework/framework/components/fake click chainlink/devenv/fakes href "https://github.com/smartcontractkit/chainlink" - chainlink/integration-tests --> chainlink-testing-framework/havoc chainlink/integration-tests --> chainlink-testing-framework/sentinel chainlink/integration-tests --> chainlink/deployment click chainlink/integration-tests href "https://github.com/smartcontractkit/chainlink" + chainlink/load-tests --> chainlink-testing-framework/havoc chainlink/load-tests --> chainlink/integration-tests click chainlink/load-tests href "https://github.com/smartcontractkit/chainlink" chainlink/system-tests/lib --> chainlink-testing-framework/framework/components/dockercompose diff --git a/integration-tests/actions/actions.go b/integration-tests/actions/actions.go deleted file mode 100644 index 86cae22f396..00000000000 --- a/integration-tests/actions/actions.go +++ /dev/null @@ -1,1357 +0,0 @@ -// Package actions enables common chainlink interactions -package actions - -import ( - "context" - "crypto/ecdsa" - "encoding/json" - "fmt" - "math" - "math/big" - "math/rand" - "strings" - "sync" - "testing" - "time" - - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/pelletier/go-toml/v2" - - geth "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "go.uber.org/zap/zapcore" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - ethContracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" - - "github.com/ethereum/go-ethereum/accounts/abi" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - - "github.com/rs/zerolog" - - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - gethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/pkg/errors" - "github.com/stretchr/testify/require" - - ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/link_token_interface" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/operatorforwarder/generated/operator_factory" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ocr" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" -) - -// ChainlinkNodeAddresses will return all the on-chain wallet addresses for a set of Chainlink nodes -func ChainlinkNodeAddresses(nodes []*nodeclient.ChainlinkK8sClient) ([]common.Address, error) { - addresses := make([]common.Address, 0) - for _, node := range nodes { - primaryAddress, err := node.PrimaryEthAddress() - if err != nil { - return nil, err - } - addresses = append(addresses, common.HexToAddress(primaryAddress)) - } - return addresses, nil -} - -// ChainlinkNodeAddressesAtIndex will return all the on-chain wallet addresses for a set of Chainlink nodes -func ChainlinkNodeAddressesAtIndex(nodes []*nodeclient.ChainlinkK8sClient, keyIndex int) ([]common.Address, error) { - addresses := make([]common.Address, 0) - for _, node := range nodes { - nodeAddresses, err := node.EthAddresses() - if err != nil { - return nil, err - } - addresses = append(addresses, common.HexToAddress(nodeAddresses[keyIndex])) - } - return addresses, nil -} - -// EncodeOnChainVRFProvingKey encodes uncompressed public VRF key to on-chain representation -func EncodeOnChainVRFProvingKey(vrfKey nodeclient.VRFKey) ([2]*big.Int, error) { - uncompressed := vrfKey.Data.Attributes.Uncompressed - provingKey := [2]*big.Int{} - var set1 bool - var set2 bool - // strip 0x to convert to int - provingKey[0], set1 = new(big.Int).SetString(uncompressed[2:66], 16) - if !set1 { - return [2]*big.Int{}, errors.New("can not convert VRF key to *big.Int") - } - provingKey[1], set2 = new(big.Int).SetString(uncompressed[66:], 16) - if !set2 { - return [2]*big.Int{}, errors.New("can not convert VRF key to *big.Int") - } - return provingKey, nil -} - -// EncodeOnChainExternalJobID encodes external job uuid to on-chain representation -func EncodeOnChainExternalJobID(jobID uuid.UUID) [32]byte { - var ji [32]byte - copy(ji[:], strings.Replace(jobID.String(), "-", "", 4)) - return ji -} - -// todo - move to CTF -func GenerateWallet() (common.Address, error) { - privateKey, err := crypto.GenerateKey() - if err != nil { - return common.Address{}, err - } - publicKey := privateKey.Public() - publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) - if !ok { - return common.Address{}, errors.New("cannot assert type: publicKey is not of type *ecdsa.PublicKey") - } - return crypto.PubkeyToAddress(*publicKeyECDSA), nil -} - -// todo - move to CTF -func GetTxFromAddress(tx *types.Transaction) (string, error) { - from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx) - return from.String(), err -} - -// todo - move to CTF -func DecodeTxInputData(abiString string, data []byte) (map[string]any, error) { - jsonABI, err := abi.JSON(strings.NewReader(abiString)) - if err != nil { - return nil, err - } - methodSigData := data[:4] - inputsSigData := data[4:] - method, err := jsonABI.MethodById(methodSigData) - if err != nil { - return nil, err - } - inputsMap := make(map[string]any) - if err := method.Inputs.UnpackIntoMap(inputsMap, inputsSigData); err != nil { - return nil, err - } - return inputsMap, nil -} - -// todo - move to CTF -func WaitForBlockNumberToBe( - ctx context.Context, - waitForBlockNumberToBe uint64, - client *seth.Client, - wg *sync.WaitGroup, - desiredBlockNumberReached chan<- bool, - timeout time.Duration, - l zerolog.Logger, -) (uint64, error) { - blockNumberChannel := make(chan uint64) - errorChannel := make(chan error) - testContext, testCancel := context.WithTimeout(context.Background(), timeout) - defer testCancel() - ticker := time.NewTicker(time.Second * 5) - var latestBlockNumber uint64 - for { - select { - case <-testContext.Done(): - ticker.Stop() - wg.Done() - return latestBlockNumber, - fmt.Errorf("timeout waiting for Block Number to be: %d. Last recorded block number was: %d", - waitForBlockNumberToBe, latestBlockNumber) - case <-ticker.C: - go func() { - currentBlockNumber, err := client.Client.BlockNumber(ctx) - if err != nil { - errorChannel <- err - } - l.Info(). - Uint64("Latest Block Number", currentBlockNumber). - Uint64("Desired Block Number", waitForBlockNumberToBe). - Msg("Waiting for Block Number to be") - blockNumberChannel <- currentBlockNumber - }() - case latestBlockNumber = <-blockNumberChannel: - if latestBlockNumber >= waitForBlockNumberToBe { - ticker.Stop() - wg.Done() - if desiredBlockNumberReached != nil { - desiredBlockNumberReached <- true - } - l.Info(). - Uint64("Latest Block Number", latestBlockNumber). - Uint64("Desired Block Number", waitForBlockNumberToBe). - Msg("Desired Block Number reached!") - return latestBlockNumber, nil - } - case err := <-errorChannel: - ticker.Stop() - wg.Done() - return 0, err - } - } -} - -var ContractDeploymentInterval = 200 - -// 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 FundChainlinkNodesFromRootAddress( - logger zerolog.Logger, - client *seth.Client, - nodes []contracts.ChainlinkNodeWithKeysAndAddress, - amount *big.Float, -) error { - if len(client.PrivateKeys) == 0 { - return errors.Wrap(errors.New(seth.ErrNoKeyLoaded), fmt.Sprintf("requested key: %d", 0)) - } - - return FundChainlinkNodes(logger, client, nodes, client.PrivateKeys[0], amount) -} - -// 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 FundChainlinkNodes( - logger zerolog.Logger, - client *seth.Client, - nodes []contracts.ChainlinkNodeWithKeysAndAddress, - privateKey *ecdsa.PrivateKey, - amount *big.Float, -) error { - keyAddressFn := func(cl contracts.ChainlinkNodeWithKeysAndAddress) (string, error) { - return cl.PrimaryEthAddress() - } - return fundChainlinkNodesAtAnyKey(logger, client, nodes, privateKey, amount, keyAddressFn) -} - -// FundChainlinkNodesAtKeyIndexFromRootAddress 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. It sends the funds to -// node address at keyIndex (as each node can have multiple addresses). -func FundChainlinkNodesAtKeyIndexFromRootAddress( - logger zerolog.Logger, - client *seth.Client, - nodes []contracts.ChainlinkNodeWithKeysAndAddress, - amount *big.Float, - keyIndex int, -) error { - if len(client.PrivateKeys) == 0 { - return errors.Wrap(errors.New(seth.ErrNoKeyLoaded), fmt.Sprintf("requested key: %d", 0)) - } - - return FundChainlinkNodesAtKeyIndex(logger, client, nodes, client.PrivateKeys[0], amount, keyIndex) -} - -// FundChainlinkNodesAtKeyIndex 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. It sends the funds to -// node address at keyIndex (as each node can have multiple addresses). -func FundChainlinkNodesAtKeyIndex( - logger zerolog.Logger, - client *seth.Client, - nodes []contracts.ChainlinkNodeWithKeysAndAddress, - privateKey *ecdsa.PrivateKey, - amount *big.Float, - keyIndex int, -) error { - keyAddressFn := func(cl contracts.ChainlinkNodeWithKeysAndAddress) (string, error) { - toAddress, err := cl.EthAddresses() - if err != nil { - return "", err - } - return toAddress[keyIndex], nil - } - return fundChainlinkNodesAtAnyKey(logger, client, nodes, privateKey, amount, keyAddressFn) -} - -func fundChainlinkNodesAtAnyKey( - logger zerolog.Logger, - client *seth.Client, - nodes []contracts.ChainlinkNodeWithKeysAndAddress, - privateKey *ecdsa.PrivateKey, - amount *big.Float, - keyAddressFn func(contracts.ChainlinkNodeWithKeysAndAddress) (string, error), -) error { - for _, cl := range nodes { - toAddress, err := keyAddressFn(cl) - if err != nil { - return err - } - - fromAddress, err := PrivateKeyToAddress(privateKey) - if err != nil { - return err - } - - receipt, err := SendFunds(logger, client, FundsToSendPayload{ - ToAddress: common.HexToAddress(toAddress), - Amount: conversions.EtherToWei(amount), - PrivateKey: privateKey, - }) - if err != nil { - logger.Err(err). - Str("From", fromAddress.Hex()). - Str("To", toAddress). - Msg("Failed to fund Chainlink node") - - return err - } - - txHash := "(none)" - if receipt != nil { - txHash = receipt.TxHash.String() - } - - logger.Info(). - Str("From", fromAddress.Hex()). - Str("To", toAddress). - Str("TxHash", txHash). - Str("Amount", amount.String()). - Msg("Funded Chainlink node") - } - - return nil -} - -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 -} - -// 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 SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPayload) (*types.Receipt, error) { - fromAddress, err := PrivateKeyToAddress(payload.PrivateKey) - if err != nil { - return nil, err - } - - ctx, cancel := context.WithTimeout(context.Background(), client.Cfg.Network.TxnTimeout.Duration()) - nonce, err := client.Client.PendingNonceAt(ctx, fromAddress) - defer cancel() - if err != nil { - return nil, err - } - - gasLimit, err := client.EstimateGasLimitForFundTransfer(fromAddress, payload.ToAddress, payload.Amount) - if err != nil { - transferGasFee := client.Cfg.Network.TransferGasFee - if transferGasFee < 0 { - return nil, fmt.Errorf("negative transfer gas fee: %d", transferGasFee) - } - gasLimit = uint64(transferGasFee) - } - - gasPrice := big.NewInt(0) - gasFeeCap := big.NewInt(0) - gasTipCap := big.NewInt(0) - - if payload.GasLimit != nil { - if *payload.GasLimit < 0 { - return nil, fmt.Errorf("negative gas limit: %d", *payload.GasLimit) - } - gasLimit = uint64(*payload.GasLimit) - } - - if client.Cfg.Network.EIP1559DynamicFees { - // if any of the dynamic fees are not set, we need to either estimate them or read them from config - if payload.GasFeeCap == nil || payload.GasTipCap == nil { - // estimation or config reading happens here - txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit)) - gasFeeCap = txOptions.GasFeeCap - gasTipCap = txOptions.GasTipCap - } - - // override with payload values if they are set - if payload.GasFeeCap != nil { - gasFeeCap = payload.GasFeeCap - } - - if payload.GasTipCap != nil { - gasTipCap = payload.GasTipCap - } - } else { - if payload.GasPrice == nil { - txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit)) - gasPrice = txOptions.GasPrice - } else { - gasPrice = payload.GasPrice - } - } - - var rawTx types.TxData - - if client.Cfg.Network.EIP1559DynamicFees { - rawTx = &types.DynamicFeeTx{ - Nonce: nonce, - To: &payload.ToAddress, - Value: payload.Amount, - Gas: gasLimit, - GasFeeCap: gasFeeCap, - GasTipCap: gasTipCap, - } - } else { - rawTx = &types.LegacyTx{ - Nonce: nonce, - To: &payload.ToAddress, - Value: payload.Amount, - Gas: gasLimit, - GasPrice: gasPrice, - } - } - - signedTx, err := types.SignNewTx(payload.PrivateKey, types.LatestSignerForChainID(big.NewInt(client.ChainID)), rawTx) - - if err != nil { - return nil, errors.Wrap(err, "failed to sign tx") - } - - txTimeout := client.Cfg.Network.TxnTimeout.Duration() - if payload.TxTimeout != nil { - txTimeout = *payload.TxTimeout - } - - logger.Debug(). - Str("From", fromAddress.Hex()). - Str("To", payload.ToAddress.Hex()). - Str("Amount (wei/ether)", fmt.Sprintf("%s/%s", payload.Amount, conversions.WeiToEther(payload.Amount).Text('f', -1))). - Uint64("Nonce", nonce). - Uint64("Gas Limit", gasLimit). - Str("Gas Price", gasPrice.String()). - Str("Gas Fee Cap", gasFeeCap.String()). - Str("Gas Tip Cap", gasTipCap.String()). - Bool("Dynamic fees", client.Cfg.Network.EIP1559DynamicFees). - Msg("About to send funds") - - ctx, cancel = context.WithTimeout(ctx, txTimeout) - defer cancel() - err = client.Client.SendTransaction(ctx, signedTx) - if err != nil { - return nil, errors.Wrap(err, "failed to send transaction") - } - - logger.Debug(). - Str("From", fromAddress.Hex()). - Str("To", payload.ToAddress.Hex()). - Str("TxHash", signedTx.Hash().String()). - Str("Amount (wei/ether)", fmt.Sprintf("%s/%s", payload.Amount, conversions.WeiToEther(payload.Amount).Text('f', -1))). - Uint64("Nonce", nonce). - Uint64("Gas Limit", gasLimit). - Str("Gas Price", gasPrice.String()). - Str("Gas Fee Cap", gasFeeCap.String()). - Str("Gas Tip Cap", gasTipCap.String()). - Bool("Dynamic fees", client.Cfg.Network.EIP1559DynamicFees). - Msg("Sent funds") - - receipt, receiptErr := client.WaitMined(ctx, logger, client.Client, signedTx) - if receiptErr != nil { - return nil, errors.Wrap(receiptErr, "failed to wait for transaction to be mined") - } - - if receipt.Status == 1 { - return receipt, nil - } - - tx, _, err := client.Client.TransactionByHash(ctx, signedTx.Hash()) - if err != nil { - return nil, errors.Wrap(err, "failed to get transaction by hash ") - } - - _, err = client.Decode(tx, receiptErr) - if err != nil { - return nil, err - } - - return receipt, nil -} - -// 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 DeployForwarderContracts( - t *testing.T, - seth *seth.Client, - linkTokenAddress common.Address, - numberOfOperatorForwarderPairs int, -) (operators []common.Address, authorizedForwarders []common.Address, operatorFactoryInstance contracts.OperatorFactory) { - instance, err := contracts.DeployEthereumOperatorFactory(seth, linkTokenAddress) - require.NoError(t, err, "failed to create new instance of operator factory") - operatorFactoryInstance = &instance - - for range numberOfOperatorForwarderPairs { - tx, deployErr := operatorFactoryInstance.DeployNewOperatorAndForwarder() - decodedTx, err := seth.Decode(tx, deployErr) - require.NoError(t, err, "Deploying new operator with proposed ownership with forwarder shouldn't fail") - - for i, event := range decodedTx.Events { - require.NotEmpty(t, event.Topics, "Event %d should have topics", i) - switch event.Topics[0] { - case operator_factory.OperatorFactoryOperatorCreated{}.Topic().String(): - if address, ok := event.EventData["operator"]; ok { - operators = append(operators, address.(common.Address)) - } else { - require.Fail(t, "Operator address not found in event", event) - } - case operator_factory.OperatorFactoryAuthorizedForwarderCreated{}.Topic().String(): - if address, ok := event.EventData["forwarder"]; ok { - authorizedForwarders = append(authorizedForwarders, address.(common.Address)) - } else { - require.Fail(t, "Forwarder address not found in event", event) - } - } - } - } - return operators, authorizedForwarders, operatorFactoryInstance -} - -// 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. -func WatchNewOCRRound( - l zerolog.Logger, - seth *seth.Client, - roundNumber int64, - ocrInstances []contracts.OffChainAggregatorWithRounds, - timeout time.Duration, -) error { - confirmed := make(map[string]bool) - timeoutC := time.After(timeout) - ticker := time.NewTicker(time.Millisecond * 200) - defer ticker.Stop() - - l.Info().Msgf("Waiting for round %d to be confirmed by all nodes", roundNumber) - - for { - select { - case <-timeoutC: - return fmt.Errorf("timeout waiting for round %d to be confirmed. %d/%d nodes confirmed it", roundNumber, len(confirmed), len(ocrInstances)) - case <-ticker.C: - for i := range ocrInstances { - if confirmed[ocrInstances[i].Address()] { - continue - } - ctx, cancel := context.WithTimeout(context.Background(), seth.Cfg.Network.TxnTimeout.Duration()) - roundData, err := ocrInstances[i].GetLatestRound(ctx) - if err != nil { - cancel() - return fmt.Errorf("getting latest round from OCR instance %d have failed: %w", i+1, err) - } - cancel() - if roundData.RoundId.Cmp(big.NewInt(roundNumber)) >= 0 { - l.Debug().Msgf("OCR instance %d/%d confirmed round %d", i+1, len(ocrInstances), roundNumber) - confirmed[ocrInstances[i].Address()] = true - } - } - if len(confirmed) == len(ocrInstances) { - return nil - } - } - } -} - -// 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 AcceptAuthorizedReceiversOperator( - t *testing.T, - logger zerolog.Logger, - seth *seth.Client, - operator common.Address, - authorizedForwarder common.Address, - nodeAddresses []common.Address, -) { - operatorInstance, err := contracts.LoadEthereumOperator(logger, seth, operator) - require.NoError(t, err, "Loading operator contract shouldn't fail") - forwarderInstance, err := contracts.LoadEthereumAuthorizedForwarder(seth, authorizedForwarder) - require.NoError(t, err, "Loading authorized forwarder contract shouldn't fail") - - err = operatorInstance.AcceptAuthorizedReceivers([]common.Address{authorizedForwarder}, nodeAddresses) - require.NoError(t, err, "Accepting authorized forwarder shouldn't fail") - - senders, err := forwarderInstance.GetAuthorizedSenders(testcontext.Get(t)) - require.NoError(t, err, "Getting authorized senders shouldn't fail") - var nodesAddrs []string - for _, o := range nodeAddresses { - nodesAddrs = append(nodesAddrs, o.Hex()) - } - require.Equal(t, nodesAddrs, senders, "Senders addresses should match node addresses") - - owner, err := forwarderInstance.Owner(testcontext.Get(t)) - require.NoError(t, err, "Getting authorized forwarder owner shouldn't fail") - require.Equal(t, operator.Hex(), owner, "Forwarder owner should match operator") -} - -// TrackForwarder creates forwarder track for a given Chainlink node -func TrackForwarder( - t *testing.T, - seth *seth.Client, - authorizedForwarder common.Address, - node contracts.ChainlinkNodeWithForwarder, -) { - l := logging.GetTestLogger(t) - chainID := big.NewInt(seth.ChainID) - _, _, err := node.TrackForwarder(chainID, authorizedForwarder) - require.NoError(t, err, "Forwarder track should be created") - l.Info().Str("NodeURL", node.GetConfig().URL). - Str("ForwarderAddress", authorizedForwarder.Hex()). - Str("ChaindID", chainID.String()). - Msg("Forwarder tracked") -} - -// SetupOCRv2Contracts deploys a number of OCRv2 contracts and configures them with defaults -func SetupOCRv2Contracts( - l zerolog.Logger, - seth *seth.Client, - ocrContractsConfig ocr.OffChainAggregatorsConfig, - linkTokenAddress common.Address, - transmitters []string, - ocrOptions contracts.OffchainOptions, -) ([]contracts.OffchainAggregatorV2, error) { - var ocrInstances []contracts.OffchainAggregatorV2 - - if ocrContractsConfig == nil { - return nil, errors.New("you need to pass non-nil OffChainAggregatorsConfig to setup OCR contracts") - } - - if !ocrContractsConfig.UseExistingOffChainAggregatorsContracts() { - for contractCount := 0; contractCount < ocrContractsConfig.NumberOfContractsToDeploy(); contractCount++ { - ocrInstance, err := contracts.DeployOffchainAggregatorV2( - l, - seth, - linkTokenAddress, - ocrOptions, - ) - if err != nil { - return nil, fmt.Errorf("OCRv2 instance deployment have failed: %w", err) - } - ocrInstances = append(ocrInstances, &ocrInstance) - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - } else { - for _, address := range ocrContractsConfig.OffChainAggregatorsContractsAddresses() { - ocrInstance, err := contracts.LoadOffchainAggregatorV2(l, seth, address) - if err != nil { - return nil, fmt.Errorf("OCRv2 instance loading have failed: %w", err) - } - ocrInstances = append(ocrInstances, &ocrInstance) - } - - if !ocrContractsConfig.ConfigureExistingOffChainAggregatorsContracts() { - return ocrInstances, nil - } - } - - // Gather address payees - var payees []string - for range transmitters { - payees = append(payees, seth.Addresses[0].Hex()) - } - - // Set Payees - for contractCount, ocrInstance := range ocrInstances { - err := ocrInstance.SetPayees(transmitters, payees) - if err != nil { - return nil, fmt.Errorf("error settings OCR payees: %w", err) - } - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - return ocrInstances, nil -} - -// ConfigureOCRv2AggregatorContracts sets configuration for a number of OCRv2 contracts -func ConfigureOCRv2AggregatorContracts( - contractConfig *contracts.OCRv2Config, - ocrv2Contracts []contracts.OffchainAggregatorV2, -) error { - for contractCount, ocrInstance := range ocrv2Contracts { - // Exclude the first node, which will be used as a bootstrapper - err := ocrInstance.SetConfig(contractConfig) - if err != nil { - return fmt.Errorf("error setting OCR config for contract '%s': %w", ocrInstance.Address(), err) - } - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - return nil -} - -// ReturnFunds attempts to return all the funds from the chainlink nodes to the network's default address -// all from a remote, k8s style environment -// Remove this once ccip-tests are moved to seth client -func ReturnFunds(lggr zerolog.Logger, chainlinkNodes []*nodeclient.ChainlinkK8sClient, blockchainClient blockchain.EVMClient) error { - if blockchainClient == nil { - return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") - } - lggr.Info().Msg("Attempting to return Chainlink node funds to default network wallets") - if blockchainClient.NetworkSimulated() { - lggr.Info().Str("Network Name", blockchainClient.GetNetworkName()). - Msg("Network is a simulated network. Skipping fund return.") - return nil - } - - for _, chainlinkNode := range chainlinkNodes { - fundedKeys, err := chainlinkNode.ExportEVMKeysForChain(blockchainClient.GetChainID().String()) - if err != nil { - return err - } - for _, key := range fundedKeys { - keyToDecrypt, err := json.Marshal(key) - if err != nil { - return err - } - // This can take up a good bit of RAM and time. When running on the remote-test-runner, this can lead to OOM - // issues. So we avoid running in parallel; slower, but safer. - decryptedKey, err := keystore.DecryptKey(keyToDecrypt, nodeclient.ChainlinkKeyPassword) - if err != nil { - return err - } - err = blockchainClient.ReturnFunds(decryptedKey.PrivateKey) - if err != nil { - lggr.Error().Err(err).Str("Address", fundedKeys[0].Address).Msg("Error returning funds from Chainlink node") - } - } - } - return blockchainClient.WaitForEvents() -} - -// 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 TeardownSuite( - t *testing.T, - chainClient *seth.Client, - env *environment.Environment, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics - failingLogLevel zapcore.Level, // Examines logs after the test, and fails the test if any Chainlink logs are found at or above provided level - grafnaUrlProvider testreporters.GrafanaURLProvider, - evmClients ...blockchain.EVMClient, -) error { - l := logging.GetTestLogger(t) - if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel, grafnaUrlProvider); err != nil { - return fmt.Errorf("Error dumping environment logs, leaving environment running for manual retrieval, err: %w", err) - } - // Delete all jobs to stop depleting the funds - err := DeleteAllJobs(chainlinkNodes) - if err != nil { - l.Warn().Msgf("Error deleting jobs %+v", err) - } - - if chainlinkNodes != nil && chainClient != nil { - if err := ReturnFundsFromNodes(l, chainClient, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(chainlinkNodes)); err != nil { - // This printed line is required for tests that use real funds to propagate the failure - // out to the system running the test. Do not remove - fmt.Println(environment.FAILED_FUND_RETURN) - l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). - Msg("Error attempting to return funds from chainlink nodes to network's default wallet. " + - "Environment is left running so you can try manually!") - } - } else { - l.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") - } - // The following is needed for tests using EVMClient, - // Remove this once ccip-tests are moved to seth client - for _, c := range evmClients { - if c != nil && chainlinkNodes != nil && len(chainlinkNodes) > 0 { - if err := ReturnFunds(l, chainlinkNodes, c); err != nil { - // This printed line is required for tests that use real funds to propagate the failure - // out to the system running the test. Do not remove - fmt.Println(environment.FAILED_FUND_RETURN) - l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). - Msg("Error attempting to return funds from chainlink nodes to network's default wallet. " + - "Environment is left running so you can try manually!") - } - } else { - l.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") - } - if c != nil { - err := c.Close() - if err != nil { - return err - } - } - } - - return env.Shutdown() -} - -// TeardownRemoteSuite sends a report and returns funds from chainlink nodes to network's default wallet -func TeardownRemoteSuite( - t *testing.T, - client *seth.Client, - namespace string, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics - grafnaUrlProvider testreporters.GrafanaURLProvider, -) error { - l := logging.GetTestLogger(t) - if err := testreporters.SendReport(t, namespace, "./", optionalTestReporter, grafnaUrlProvider); err != nil { - l.Warn().Err(err).Msg("Error writing test report") - } - // Delete all jobs to stop depleting the funds - err := DeleteAllJobs(chainlinkNodes) - if err != nil { - l.Warn().Msgf("Error deleting jobs %+v", err) - } - - if err = ReturnFundsFromNodes(l, client, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(chainlinkNodes)); err != nil { - l.Error().Err(err).Str("Namespace", namespace). - Msg("Error attempting to return funds from chainlink nodes to network's default wallet. " + - "Environment is left running so you can try manually!") - } - - return err -} - -// DeleteAllJobs deletes all jobs from all chainlink nodes -// added here temporarily to avoid circular import -func DeleteAllJobs(chainlinkNodes []*nodeclient.ChainlinkK8sClient) error { - for _, node := range chainlinkNodes { - if node == nil { - return fmt.Errorf("found a nil chainlink node in the list of chainlink nodes while tearing down: %v", chainlinkNodes) - } - jobs, _, err := node.ReadJobs() - if err != nil { - return fmt.Errorf("error reading jobs from chainlink node, err: %w", err) - } - for _, maps := range jobs.Data { - if _, ok := maps["id"]; !ok { - return fmt.Errorf("error reading job id from chainlink node's jobs %+v", jobs.Data) - } - id := maps["id"].(string) - _, err := node.DeleteJob(id) - if err != nil { - return fmt.Errorf("error deleting job from chainlink node, err: %w", err) - } - } - } - return nil -} - -// StartNewRound requests a new round from the ocr contracts and returns once transaction was mined -func StartNewRound( - ocrInstances []contracts.OffChainAggregatorWithRounds, -) error { - for i := range ocrInstances { - err := ocrInstances[i].RequestNewRound() - if err != nil { - return fmt.Errorf("requesting new OCR round %d have failed: %w", i+1, err) - } - } - return nil -} - -// DeployOCRContractsForwarderFlow deploys and funds a certain number of offchain -// aggregator contracts with forwarders as effectiveTransmitters -func DeployOCRContractsForwarderFlow( - logger zerolog.Logger, - seth *seth.Client, - ocrContractsConfig ocr.OffChainAggregatorsConfig, - linkTokenContractAddress common.Address, - workerNodes []contracts.ChainlinkNodeWithKeysAndAddress, - forwarderAddresses []common.Address, -) ([]contracts.OffchainAggregator, error) { - transmitterPayeesFn := func() (transmitters []string, payees []string, err error) { - transmitters = make([]string, 0) - payees = make([]string, 0) - for _, forwarderCommonAddress := range forwarderAddresses { - forwarderAddress := forwarderCommonAddress.Hex() - transmitters = append(transmitters, forwarderAddress) - payees = append(payees, seth.Addresses[0].Hex()) - } - - return - } - - transmitterAddressesFn := func() ([]common.Address, error) { - return forwarderAddresses, nil - } - - return setupAnyOCRv1Contracts(logger, seth, ocrContractsConfig, linkTokenContractAddress, workerNodes, transmitterPayeesFn, transmitterAddressesFn) -} - -// SetupOCRv1Contracts deploys and funds a certain number of offchain aggregator contracts or uses existing ones and returns a slice of contract wrappers. -func SetupOCRv1Contracts( - logger zerolog.Logger, - seth *seth.Client, - ocrContractsConfig ocr.OffChainAggregatorsConfig, - linkTokenContractAddress common.Address, - workerNodes []contracts.ChainlinkNodeWithKeysAndAddress, -) ([]contracts.OffchainAggregator, error) { - transmitterPayeesFn := func() (transmitters []string, payees []string, err error) { - transmitters = make([]string, 0) - payees = make([]string, 0) - for _, n := range workerNodes { - var addr string - addr, err = n.PrimaryEthAddress() - if err != nil { - err = fmt.Errorf("error getting node's primary ETH address: %w", err) - return - } - transmitters = append(transmitters, addr) - payees = append(payees, seth.Addresses[0].Hex()) - } - - return - } - - transmitterAddressesFn := func() ([]common.Address, error) { - transmitterAddresses := make([]common.Address, 0) - for _, n := range workerNodes { - primaryAddress, err := n.PrimaryEthAddress() - if err != nil { - return nil, err - } - transmitterAddresses = append(transmitterAddresses, common.HexToAddress(primaryAddress)) - } - - return transmitterAddresses, nil - } - - return setupAnyOCRv1Contracts(logger, seth, ocrContractsConfig, linkTokenContractAddress, workerNodes, transmitterPayeesFn, transmitterAddressesFn) -} - -func setupAnyOCRv1Contracts( - logger zerolog.Logger, - seth *seth.Client, - ocrContractsConfig ocr.OffChainAggregatorsConfig, - linkTokenContractAddress common.Address, - workerNodes []contracts.ChainlinkNodeWithKeysAndAddress, - getTransmitterAndPayeesFn func() ([]string, []string, error), - getTransmitterAddressesFn func() ([]common.Address, error), -) ([]contracts.OffchainAggregator, error) { - var ocrInstances []contracts.OffchainAggregator - - if ocrContractsConfig == nil { - return nil, errors.New("you need to pass non-nil OffChainAggregatorsConfig to setup OCR contracts") - } - - if !ocrContractsConfig.UseExistingOffChainAggregatorsContracts() { - // Deploy contracts - for contractCount := 0; contractCount < ocrContractsConfig.NumberOfContractsToDeploy(); contractCount++ { - ocrInstance, err := contracts.DeployOffchainAggregator(logger, seth, linkTokenContractAddress, contracts.DefaultOffChainAggregatorOptions()) - if err != nil { - return nil, fmt.Errorf("OCR instance deployment have failed: %w", err) - } - ocrInstances = append(ocrInstances, &ocrInstance) - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - } else { - // Load contract wrappers - for _, address := range ocrContractsConfig.OffChainAggregatorsContractsAddresses() { - ocrInstance, err := contracts.LoadOffChainAggregator(logger, seth, address) - if err != nil { - return nil, fmt.Errorf("OCR instance loading have failed: %w", err) - } - ocrInstances = append(ocrInstances, &ocrInstance) - } - - if !ocrContractsConfig.ConfigureExistingOffChainAggregatorsContracts() { - return ocrInstances, nil - } - } - - // Gather transmitter and address payees - var transmitters, payees []string - var err error - transmitters, payees, err = getTransmitterAndPayeesFn() - if err != nil { - return nil, fmt.Errorf("error getting transmitter and payees: %w", err) - } - - // Set Payees - for contractCount, ocrInstance := range ocrInstances { - err := ocrInstance.SetPayees(transmitters, payees) - if err != nil { - return nil, fmt.Errorf("error settings OCR payees: %w", err) - } - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - - // Set Config - transmitterAddresses, err := getTransmitterAddressesFn() - if err != nil { - return nil, fmt.Errorf("getting transmitter addresses should not fail: %w", err) - } - - for contractCount, ocrInstance := range ocrInstances { - // Exclude the first node, which will be used as a bootstrapper - err = ocrInstance.SetConfig( - workerNodes, - contracts.DefaultOffChainAggregatorConfig(len(workerNodes)), - transmitterAddresses, - ) - if err != nil { - return nil, fmt.Errorf("error setting OCR config for contract '%s': %w", ocrInstance.Address(), err) - } - if (contractCount+1)%ContractDeploymentInterval == 0 { // For large amounts of contract deployments, space things out some - time.Sleep(2 * time.Second) - } - } - - return ocrInstances, nil -} - -func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (common.Address, error) { - publicKey := privateKey.Public() - publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) - if !ok { - return common.Address{}, errors.New("error casting public key to ECDSA") - } - return crypto.PubkeyToAddress(*publicKeyECDSA), nil -} - -func WatchNewFluxRound( - l zerolog.Logger, - seth *seth.Client, - roundNumber int64, - fluxInstance contracts.FluxAggregator, - timeout time.Duration, -) error { - timeoutC := time.After(timeout) - ticker := time.NewTicker(time.Millisecond * 200) - defer ticker.Stop() - - l.Info().Msgf("Waiting for flux round %d to be confirmed by flux aggregator", roundNumber) - - for { - select { - case <-timeoutC: - return fmt.Errorf("timeout waiting for round %d to be confirmed", roundNumber) - case <-ticker.C: - ctx, cancel := context.WithTimeout(context.Background(), seth.Cfg.Network.TxnTimeout.Duration()) - roundId, err := fluxInstance.LatestRoundID(ctx) - if err != nil { - cancel() - return fmt.Errorf("getting latest round from flux instance has failed: %w", err) - } - cancel() - if roundId.Cmp(big.NewInt(roundNumber)) >= 0 { - l.Debug().Msgf("Flux instance confirmed round %d", roundNumber) - return nil - } - } - } -} - -// SendLinkFundsToDeploymentAddresses sends LINK token to all addresses, but the root one, from the root address. It uses -// Multicall contract to batch all transfers in a single transaction. It also checks if the funds were transferred correctly. -// It's primary use case is to fund addresses that will be used for Upkeep registration (as that requires LINK balance) during -// Automation/Keeper test setup. -func SendLinkFundsToDeploymentAddresses( - chainClient *seth.Client, - concurrency, - totalUpkeeps, - operationsPerAddress int, - multicallAddress common.Address, - linkAmountPerUpkeep *big.Int, - linkToken contracts.LinkToken, -) error { - var generateCallData = func(receiver common.Address, amount *big.Int) ([]byte, error) { - abi, err := link_token_interface.LinkTokenMetaData.GetAbi() - if err != nil { - return nil, err - } - data, err := abi.Pack("transfer", receiver, amount) - if err != nil { - return nil, err - } - return data, nil - } - - toTransferToMultiCallContract := big.NewInt(0).Mul(linkAmountPerUpkeep, big.NewInt(int64(totalUpkeeps+concurrency))) - toTransferPerClient := big.NewInt(0).Mul(linkAmountPerUpkeep, big.NewInt(int64(operationsPerAddress+1))) - - // As a hack we use the geth wrapper directly, because we need to access receipt to get block number, which we will use to query the balance - // This is needed as querying with 'latest' block number very rarely, but still, return stale balance. That's happening even though we wait for - // the transaction to be mined. - linkInstance, err := link_token_interface.NewLinkToken(common.HexToAddress(linkToken.Address()), wrappers.MustNewWrappedContractBackend(nil, chainClient)) - if err != nil { - return err - } - - tx, err := chainClient.Decode(linkInstance.Transfer(chainClient.NewTXOpts(), multicallAddress, toTransferToMultiCallContract)) - if err != nil { - return err - } - - if tx.Receipt == nil { - return errors.New("transaction receipt for LINK transfer to multicall contract is nil") - } - - multiBalance, err := linkInstance.BalanceOf(&bind.CallOpts{From: chainClient.Addresses[0], BlockNumber: tx.Receipt.BlockNumber}, multicallAddress) - if err != nil { - return errors.Wrapf(err, "Error getting LINK balance of multicall contract") - } - - // Old code that's querying latest block - // err := linkToken.Transfer(multicallAddress.Hex(), toTransferToMultiCallContract) - // if err != nil { - // return errors.Wrapf(err, "Error transferring LINK to multicall contract") - //} - // - // balance, err := linkToken.BalanceOf(context.Background(), multicallAddress.Hex()) - // if err != nil { - // return errors.Wrapf(err, "Error getting LINK balance of multicall contract") - //} - - if multiBalance.Cmp(toTransferToMultiCallContract) < 0 { - return fmt.Errorf("Incorrect LINK balance of multicall contract. Expected at least: %s. Got: %s", toTransferToMultiCallContract.String(), multiBalance.String()) - } - - // Transfer LINK to ephemeral keys - multiCallData := make([][]byte, 0) - for i := 1; i <= concurrency; i++ { - data, err := generateCallData(chainClient.Addresses[i], toTransferPerClient) - if err != nil { - return errors.Wrapf(err, "Error generating call data for LINK transfer") - } - multiCallData = append(multiCallData, data) - } - - var call []contracts.Call - for _, d := range multiCallData { - data := contracts.Call{Target: common.HexToAddress(linkToken.Address()), AllowFailure: false, CallData: d} - call = append(call, data) - } - - multiCallABI, err := abi.JSON(strings.NewReader(contracts.MultiCallABI)) - if err != nil { - return errors.Wrapf(err, "Error getting Multicall contract ABI") - } - boundContract := bind.NewBoundContract(multicallAddress, multiCallABI, chainClient.Client, chainClient.Client, chainClient.Client) - // call aggregate3 to group all msg call data and send them in a single transaction - ephemeralTx, err := chainClient.Decode(boundContract.Transact(chainClient.NewTXOpts(), "aggregate3", call)) - if err != nil { - return errors.Wrapf(err, "Error calling Multicall contract") - } - - if ephemeralTx.Receipt == nil { - return errors.New("transaction receipt for LINK transfer to ephemeral keys is nil") - } - - for i := 1; i <= concurrency; i++ { - ephemeralBalance, err := linkInstance.BalanceOf(&bind.CallOpts{From: chainClient.Addresses[0], BlockNumber: ephemeralTx.Receipt.BlockNumber}, chainClient.Addresses[i]) - // Old code that's querying latest block, for now we prefer to use block number from the transaction receipt - // balance, err := linkToken.BalanceOf(context.Background(), chainClient.Addresses[i].Hex()) - if err != nil { - return errors.Wrapf(err, "Error getting LINK balance of ephemeral key %d", i) - } - if ephemeralBalance.Cmp(toTransferPerClient) < 0 { - return fmt.Errorf("Incorrect LINK balance after transfer. Ephemeral key %d. Expected: %s. Got: %s", i, toTransferPerClient.String(), ephemeralBalance.String()) - } - } - - return nil -} - -// GenerateUpkeepReport generates a report of performed, successful, reverted and stale upkeeps for a given registry contract based on transaction logs. In case of test failure it can help us -// to triage the issue by providing more context. -func GenerateUpkeepReport(t *testing.T, chainClient *seth.Client, startBlock, endBlock *big.Int, instance contracts.KeeperRegistry, registryVersion ethContracts.KeeperRegistryVersion) (performedUpkeeps, successfulUpkeeps, revertedUpkeeps, staleUpkeeps int, err error) { - registryLogs := []gethtypes.Log{} - l := logging.GetTestLogger(t) - - var ( - blockBatchSize int64 = 100 - logs []gethtypes.Log - timeout = 5 * time.Second - addr = common.HexToAddress(instance.Address()) - queryStartBlock = startBlock - ) - - // Gather logs from the registry in 100 block chunks to avoid read limits - for queryStartBlock.Cmp(endBlock) < 0 { - filterQuery := geth.FilterQuery{ - Addresses: []common.Address{addr}, - FromBlock: queryStartBlock, - ToBlock: big.NewInt(0).Add(queryStartBlock, big.NewInt(blockBatchSize)), - } - - // This RPC call can possibly time out or otherwise die. Failure is not an option, keep retrying to get our stats. - err = errors.New("initial error") // to ensure our for loop runs at least once - for err != nil { - ctx, cancel := context.WithTimeout(testcontext.Get(t), timeout) - logs, err = chainClient.Client.FilterLogs(ctx, filterQuery) - cancel() - if err != nil { - l.Error(). - Err(err). - Interface("Filter Query", filterQuery). - Str("Timeout", timeout.String()). - Msg("Error getting logs from chain, trying again") - timeout = time.Duration(math.Min(float64(timeout)*2, float64(2*time.Minute))) - continue - } - l.Info(). - Uint64("From Block", queryStartBlock.Uint64()). - Uint64("To Block", filterQuery.ToBlock.Uint64()). - Int("Log Count", len(logs)). - Str("Registry Address", addr.Hex()). - Msg("Collected logs") - queryStartBlock.Add(queryStartBlock, big.NewInt(blockBatchSize)) - registryLogs = append(registryLogs, logs...) - } - } - - var contractABI *abi.ABI - contractABI, err = contracts.GetRegistryContractABI(registryVersion) - if err != nil { - return - } - - for _, allLogs := range registryLogs { - log := allLogs - var eventDetails *abi.Event - eventDetails, err = contractABI.EventByID(log.Topics[0]) - if err != nil { - l.Error().Err(err).Str("Log Hash", log.TxHash.Hex()).Msg("Error getting event details for log, report data inaccurate") - break - } - if eventDetails.Name == "UpkeepPerformed" { - performedUpkeeps++ - var parsedLog *contracts.UpkeepPerformedLog - parsedLog, err = instance.ParseUpkeepPerformedLog(&log) - if err != nil { - l.Error().Err(err).Str("Log Hash", log.TxHash.Hex()).Msg("Error parsing upkeep performed log, report data inaccurate") - break - } - if !parsedLog.Success { - revertedUpkeeps++ - } else { - successfulUpkeeps++ - } - } else if eventDetails.Name == "StaleUpkeepReport" { - staleUpkeeps++ - } - } - - return -} - -func GetStalenessReportCleanupFn(t *testing.T, logger zerolog.Logger, chainClient *seth.Client, startBlock uint64, registry contracts.KeeperRegistry, registryVersion ethContracts.KeeperRegistryVersion) func() { - return func() { - if t.Failed() { - endBlock, err := chainClient.Client.BlockNumber(context.Background()) - require.NoError(t, err, "Failed to get end block") - - total, ok, reverted, stale, err := GenerateUpkeepReport(t, chainClient, new(big.Int).SetUint64(startBlock), new(big.Int).SetUint64(endBlock), registry, registryVersion) - require.NoError(t, err, "Failed to get staleness data") - if stale > 0 || reverted > 0 { - logger.Warn().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } else { - logger.Info().Int("Total upkeeps", total).Int("Successful upkeeps", ok).Int("Reverted Upkeeps", reverted).Int("Stale Upkeeps", stale).Msg("Staleness data") - } - } - } -} - -func BuildTOMLNodeConfigForK8s(testConfig ctfconfig.GlobalTestConfig, testNetwork blockchain.EVMNetwork) (string, error) { - nodeConfigInToml := testConfig.GetNodeConfig() - - nodeConfig, _, err := node.BuildChainlinkNodeConfig( - []blockchain.EVMNetwork{testNetwork}, - nodeConfigInToml.BaseConfigTOML, - nodeConfigInToml.CommonChainConfigTOML, - nodeConfigInToml.ChainConfigTOMLByChainID, - ) - - if err != nil { - return "", err - } - - if testConfig.GetPyroscopeConfig() != nil && *testConfig.GetPyroscopeConfig().Enabled { - nodeConfig.Pyroscope.Environment = testConfig.GetPyroscopeConfig().Environment - nodeConfig.Pyroscope.ServerAddress = testConfig.GetPyroscopeConfig().ServerUrl - } - - asStr, err := toml.Marshal(nodeConfig) - if err != nil { - return "", err - } - - return string(asStr), nil -} - -func IsOPStackChain(chainID int64) bool { - return chainID == 8453 || // BASE MAINNET - chainID == 84532 || // BASE SEPOLIA - chainID == 10 || // OPTIMISM MAINNET - chainID == 11155420 // OPTIMISM SEPOLIA -} - -func IsArbitrumChain(chainID int64) bool { - return chainID == 42161 || // Arbitrum MAINNET - chainID == 421614 // Arbitrum Sepolia -} - -func RandBool() bool { - return rand.Intn(2) == 1 -} - -func ContinuouslyGenerateTXsOnChain(sethClient *seth.Client, stopChannel chan bool, wg *sync.WaitGroup, l zerolog.Logger) (bool, error) { - counterContract, err := contracts.DeployCounterContract(sethClient) - if err != nil { - return false, err - } - err = counterContract.Reset() - if err != nil { - return false, err - } - var count *big.Int - for { - select { - case <-stopChannel: - l.Info().Str("Number of generated transactions on chain", count.String()).Msg("Stopping generating txs on chain. Desired block number reached.") - sleepDuration := time.Second * 10 - l.Info().Str("Waiting for", sleepDuration.String()).Msg("Waiting for transactions to be mined and avoid nonce issues") - time.Sleep(sleepDuration) - wg.Done() - return true, nil - default: - err = counterContract.Increment() - if err != nil { - return false, err - } - count, err = counterContract.Count() - if err != nil { - return false, err - } - l.Info().Str("Count", count.String()).Msg("Number of generated transactions on chain") - } - } -} - -func WithinTolerance(a, b, tolerance float64) (bool, float64) { - if a == b { - return true, 0 - } - diff := math.Abs(a - b) - isWithinTolerance := diff < tolerance - return isWithinTolerance, diff -} diff --git a/integration-tests/actions/automation_ocr_helpers.go b/integration-tests/actions/automation_ocr_helpers.go deleted file mode 100644 index cb6c15a53be..00000000000 --- a/integration-tests/actions/automation_ocr_helpers.go +++ /dev/null @@ -1,258 +0,0 @@ -package actions - -//revive:disable:dot-imports -import ( - "math" - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/common" - - tt "github.com/smartcontractkit/chainlink/integration-tests/types" - - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" -) - -// DeployAutoOCRRegistryAndRegistrar registry and registrar -func DeployAutoOCRRegistryAndRegistrar( - t *testing.T, - client *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - registrySettings contracts.KeeperRegistrySettings, - linkToken contracts.LinkToken, - wethToken contracts.WETHToken, - ethUSDFeed contracts.MockETHUSDFeed, -) (contracts.KeeperRegistry, contracts.KeeperRegistrar) { - registry := deployRegistry(t, client, registryVersion, registrySettings, linkToken, wethToken, ethUSDFeed) - registrar := deployRegistrar(t, client, registryVersion, registry, linkToken, wethToken) - - return registry, registrar -} - -// DeployLegacyConsumers deploys and registers keeper consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. Which means -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deploys multicall contract and sends link funds to each deployment address. -func DeployLegacyConsumers(t *testing.T, chainClient *seth.Client, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, linkToken contracts.LinkToken, numberOfUpkeeps int, linkFundsForEachUpkeep *big.Int, upkeepGasLimit uint32, isLogTrigger bool, isMercury bool, isBillingTokenNative bool, wethToken contracts.WETHToken) ([]contracts.KeeperConsumer, []*big.Int) { - // Fund deployers with LINK, no need to do this for Native token - if !isBillingTokenNative { - err := DeployMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - } - - upkeeps := DeployKeeperConsumers(t, chainClient, numberOfUpkeeps, isLogTrigger, isMercury) - require.Len(t, upkeeps, numberOfUpkeeps, "Number of upkeeps should match") - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - upkeepIds := RegisterUpkeepContracts( - t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfUpkeeps, upkeepsAddresses, isLogTrigger, isMercury, isBillingTokenNative, wethToken, - ) - require.Len(t, upkeepIds, numberOfUpkeeps, "Number of upkeepIds should match") - return upkeeps, upkeepIds -} - -// DeployConsumers deploys and registers keeper consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. Which means -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deploys multicall contract and sends link funds to each deployment address. -func DeployConsumers(t *testing.T, chainClient *seth.Client, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, linkToken contracts.LinkToken, numberOfUpkeeps int, linkFundsForEachUpkeep *big.Int, upkeepGasLimit uint32, isLogTrigger bool, isMercury bool, isBillingTokenNative bool, wethToken contracts.WETHToken, config tt.AutomationTestConfig) ([]contracts.KeeperConsumer, []*big.Int) { - // Fund deployers with LINK, no need to do this for Native token - if !isBillingTokenNative { - err := SetupMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep, config) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - } - - upkeeps := SetupKeeperConsumers(t, chainClient, numberOfUpkeeps, isLogTrigger, isMercury, config) - require.Len(t, upkeeps, numberOfUpkeeps, "Number of upkeeps should match") - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - upkeepIds := RegisterUpkeepContracts( - t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfUpkeeps, upkeepsAddresses, isLogTrigger, isMercury, isBillingTokenNative, wethToken, - ) - require.Len(t, upkeepIds, numberOfUpkeeps, "Number of upkeepIds should match") - return upkeeps, upkeepIds -} - -// DeployPerformanceConsumers deploys and registers keeper performance consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkeep will be registered with root key address as the admin. -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deploys multicall contract and sends link funds to each deployment address. -func DeployPerformanceConsumers( - t *testing.T, - chainClient *seth.Client, - registry contracts.KeeperRegistry, - registrar contracts.KeeperRegistrar, - linkToken contracts.LinkToken, - numberOfUpkeeps int, - linkFundsForEachUpkeep *big.Int, - upkeepGasLimit uint32, - blockRange, // How many blocks to run the test for - blockInterval, // Interval of blocks that upkeeps are expected to be performed - checkGasToBurn, // How much gas should be burned on checkUpkeep() calls - performGasToBurn int64, // How much gas should be burned on performUpkeep() calls - config tt.AutomationTestConfig, -) ([]contracts.KeeperConsumerPerformance, []*big.Int) { - upkeeps := DeployKeeperConsumersPerformance( - t, chainClient, numberOfUpkeeps, blockRange, blockInterval, checkGasToBurn, performGasToBurn, - ) - - err := SetupMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep, config) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - upkeepIds := RegisterUpkeepContracts(t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfUpkeeps, upkeepsAddresses, false, false, false, nil) - return upkeeps, upkeepIds -} - -// DeployPerformDataCheckerConsumers deploys and registers keeper performance data checkers consumers. If ephemeral addresses are enabled, it will deploy and register the consumers from ephemeral addresses, but each upkpeep will be registered with root key address as the admin. -// that functions like setting upkeep configuration, pausing, unpausing, etc. will be done by the root key address. It deployes multicall contract and sends link funds to each deployment address. -func DeployPerformDataCheckerConsumers( - t *testing.T, - chainClient *seth.Client, - registry contracts.KeeperRegistry, - registrar contracts.KeeperRegistrar, - linkToken contracts.LinkToken, - numberOfUpkeeps int, - linkFundsForEachUpkeep *big.Int, - upkeepGasLimit uint32, - expectedData []byte, - config tt.AutomationTestConfig, -) ([]contracts.KeeperPerformDataChecker, []*big.Int) { - upkeeps := DeployPerformDataChecker(t, chainClient, numberOfUpkeeps, expectedData) - - err := SetupMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep, config) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - upkeepIds := RegisterUpkeepContracts(t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfUpkeeps, upkeepsAddresses, false, false, false, nil) - return upkeeps, upkeepIds -} - -func SetupMultiCallAddress(chainClient *seth.Client, testConfig tt.AutomationTestConfig) (common.Address, error) { - if testConfig.GetAutomationConfig().UseExistingMultiCallContract() { - multiCallAddress, err := testConfig.GetAutomationConfig().MultiCallContractAddress() - if err != nil { - return common.Address{}, errors.Wrap(err, "Error getting existing multicall contract address") - } - return multiCallAddress, nil - } - - multicallAddress, err := contracts.DeployMultiCallContract(chainClient) - if err != nil { - return common.Address{}, errors.Wrap(err, "Error deploying multicall contract") - } - return multicallAddress, nil -} - -// SetupMultiCallAndFundDeploymentAddresses setups multicall contract and sends link funds to each deployment address -func SetupMultiCallAndFundDeploymentAddresses( - chainClient *seth.Client, - linkToken contracts.LinkToken, - numberOfUpkeeps int, - linkFundsForEachUpkeep *big.Int, - testConfig tt.AutomationTestConfig, -) error { - concurrency, err := GetAndAssertCorrectConcurrency(chainClient, 1) - if err != nil { - return err - } - - operationsPerAddress := numberOfUpkeeps / concurrency - - multicallAddress, err := SetupMultiCallAddress(chainClient, testConfig) - if err != nil { - return errors.Wrap(err, "Error deploying multicall contract") - } - - return SendLinkFundsToDeploymentAddresses(chainClient, concurrency, numberOfUpkeeps, operationsPerAddress, multicallAddress, linkFundsForEachUpkeep, linkToken) -} - -// DeployMultiCallAndFundDeploymentAddresses deploys multicall contract and sends link funds to each deployment address -func DeployMultiCallAndFundDeploymentAddresses( - chainClient *seth.Client, - linkToken contracts.LinkToken, - numberOfUpkeeps int, - linkFundsForEachUpkeep *big.Int, -) error { - concurrency, err := GetAndAssertCorrectConcurrency(chainClient, 1) - if err != nil { - return err - } - - operationsPerAddress := numberOfUpkeeps / concurrency - - multicallAddress, err := contracts.DeployMultiCallContract(chainClient) - if err != nil { - return errors.Wrap(err, "Error deploying multicall contract") - } - - return SendLinkFundsToDeploymentAddresses(chainClient, concurrency, numberOfUpkeeps, operationsPerAddress, multicallAddress, linkFundsForEachUpkeep, linkToken) -} - -func deployRegistrar( - t *testing.T, - client *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - registry contracts.KeeperRegistry, - linkToken contracts.LinkToken, - wethToken contracts.WETHToken, -) contracts.KeeperRegistrar { - registrarSettings := contracts.KeeperRegistrarSettings{ - AutoApproveConfigType: 2, - AutoApproveMaxAllowed: math.MaxUint16, - RegistryAddr: registry.Address(), - MinLinkJuels: big.NewInt(0), - WETHTokenAddr: wethToken.Address(), - } - registrar, err := contracts.DeployKeeperRegistrar(client, registryVersion, linkToken.Address(), registrarSettings) - require.NoError(t, err, "Deploying KeeperRegistrar contract shouldn't fail") - return registrar -} - -func deployRegistry( - t *testing.T, - client *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - registrySettings contracts.KeeperRegistrySettings, - linkToken contracts.LinkToken, - wethToken contracts.WETHToken, - ethUSDFeed contracts.MockETHUSDFeed, -) contracts.KeeperRegistry { - ef, err := contracts.DeployMockLINKETHFeed(client, big.NewInt(2e18)) - require.NoError(t, err, "Deploying mock ETH-Link feed shouldn't fail") - gf, err := contracts.DeployMockGASFeed(client, big.NewInt(2e11)) - require.NoError(t, err, "Deploying mock gas feed shouldn't fail") - - // Deploy the transcoder here, and then set it to the registry - transcoder, err := contracts.DeployUpkeepTranscoder(client) - require.NoError(t, err, "Deploying upkeep transcoder shouldn't fail") - - registry, err := contracts.DeployKeeperRegistry( - client, - &contracts.KeeperRegistryOpts{ - RegistryVersion: registryVersion, - LinkAddr: linkToken.Address(), - ETHFeedAddr: ef.Address(), - GasFeedAddr: gf.Address(), - TranscoderAddr: transcoder.Address(), - RegistrarAddr: ZeroAddress.Hex(), - Settings: registrySettings, - LinkUSDFeedAddr: ethUSDFeed.Address(), - NativeUSDFeedAddr: ethUSDFeed.Address(), - WrappedNativeAddr: wethToken.Address(), - }, - ) - require.NoError(t, err, "Deploying KeeperRegistry contract shouldn't fail") - return registry -} diff --git a/integration-tests/actions/automation_ocr_helpers_local.go b/integration-tests/actions/automation_ocr_helpers_local.go deleted file mode 100644 index 34b75b06852..00000000000 --- a/integration-tests/actions/automation_ocr_helpers_local.go +++ /dev/null @@ -1,331 +0,0 @@ -package actions - -//revive:disable:dot-imports -import ( - "encoding/json" - "errors" - "fmt" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/lib/pq" - "github.com/rs/zerolog" - "gopkg.in/guregu/null.v4" - - ocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - ocr2keepers20config "github.com/smartcontractkit/chainlink-automation/pkg/v2/config" - ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config" - "github.com/smartcontractkit/chainlink-common/keystore/corekeys" - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - - "github.com/smartcontractkit/chainlink/v2/core/services/job" -) - -func ReadRegistryConfig(c tc.AutomationTestConfig) contracts.KeeperRegistrySettings { - registrySettings := c.GetAutomationConfig().AutomationConfig.RegistrySettings - return contracts.KeeperRegistrySettings{ - PaymentPremiumPPB: *registrySettings.PaymentPremiumPPB, - FlatFeeMicroLINK: *registrySettings.FlatFeeMicroLINK, - CheckGasLimit: *registrySettings.CheckGasLimit, - StalenessSeconds: registrySettings.StalenessSeconds, - GasCeilingMultiplier: *registrySettings.GasCeilingMultiplier, - MinUpkeepSpend: registrySettings.MinUpkeepSpend, - MaxPerformGas: *registrySettings.MaxPerformGas, - FallbackGasPrice: registrySettings.FallbackGasPrice, - FallbackLinkPrice: registrySettings.FallbackLinkPrice, - FallbackNativePrice: registrySettings.FallbackNativePrice, - MaxCheckDataSize: *registrySettings.MaxCheckDataSize, - MaxPerformDataSize: *registrySettings.MaxPerformDataSize, - MaxRevertDataSize: *registrySettings.MaxRevertDataSize, - } -} - -func ReadPluginConfig(c tc.AutomationTestConfig) ocr2keepers30config.OffchainConfig { - plCfg := c.GetAutomationConfig().AutomationConfig.PluginConfig - return ocr2keepers30config.OffchainConfig{ - TargetProbability: *plCfg.TargetProbability, - TargetInRounds: *plCfg.TargetInRounds, - PerformLockoutWindow: *plCfg.PerformLockoutWindow, - GasLimitPerReport: *plCfg.GasLimitPerReport, - GasOverheadPerUpkeep: *plCfg.GasOverheadPerUpkeep, - MinConfirmations: *plCfg.MinConfirmations, - MaxUpkeepBatchSize: *plCfg.MaxUpkeepBatchSize, - LogProviderConfig: ocr2keepers30config.LogProviderConfig{ - BlockRate: *plCfg.LogProviderConfig.BlockRate, - LogLimit: *plCfg.LogProviderConfig.LogLimit, - }, - } -} - -func ReadPublicConfig(c tc.AutomationTestConfig) ocr3.PublicConfig { - pubCfg := c.GetAutomationConfig().AutomationConfig.PublicConfig - return ocr3.PublicConfig{ - DeltaProgress: *pubCfg.DeltaProgress, - DeltaResend: *pubCfg.DeltaResend, - DeltaInitial: *pubCfg.DeltaInitial, - DeltaRound: *pubCfg.DeltaRound, - DeltaGrace: *pubCfg.DeltaGrace, - DeltaCertifiedCommitRequest: *pubCfg.DeltaCertifiedCommitRequest, - DeltaStage: *pubCfg.DeltaStage, - RMax: *pubCfg.RMax, - MaxDurationQuery: *pubCfg.MaxDurationQuery, - MaxDurationObservation: *pubCfg.MaxDurationObservation, - MaxDurationShouldAcceptAttestedReport: *pubCfg.MaxDurationShouldAcceptAttestedReport, - MaxDurationShouldTransmitAcceptedReport: *pubCfg.MaxDurationShouldTransmitAcceptedReport, - F: *pubCfg.F, - } -} - -func BuildAutoOCR2ConfigVarsLocal( - l zerolog.Logger, - chainlinkNodes []*nodeclient.ChainlinkClient, - registryConfig contracts.KeeperRegistrySettings, - registrar string, - deltaStage time.Duration, - registryOwnerAddress common.Address, - chainModuleAddress common.Address, - reorgProtectionEnabled bool, -) (contracts.OCRv2Config, error) { - return BuildAutoOCR2ConfigVarsWithKeyIndexLocal(l, chainlinkNodes, registryConfig, registrar, deltaStage, 0, registryOwnerAddress, chainModuleAddress, reorgProtectionEnabled) -} - -func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( - l zerolog.Logger, - chainlinkNodes []*nodeclient.ChainlinkClient, - registryConfig contracts.KeeperRegistrySettings, - registrar string, - deltaStage time.Duration, - keyIndex int, - registryOwnerAddress common.Address, - chainModuleAddress common.Address, - reorgProtectionEnabled bool, -) (contracts.OCRv2Config, error) { - S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndexLocal(chainlinkNodes, keyIndex) - if err != nil { - return contracts.OCRv2Config{}, err - } - - var offC []byte - var signerOnchainPublicKeys []types.OnchainPublicKey - var transmitterAccounts []types.Account - var f uint8 - var offchainConfigVersion uint64 - var offchainConfig []byte - - if registryConfig.RegistryVersion == ethereum.RegistryVersion_2_1 || registryConfig.RegistryVersion == ethereum.RegistryVersion_2_2 { - offC, err = json.Marshal(ocr2keepers30config.OffchainConfig{ - TargetProbability: "0.999", - TargetInRounds: 1, - PerformLockoutWindow: 3600000, // Intentionally set to be higher than in prod for testing purpose - GasLimitPerReport: 5_300_000, - GasOverheadPerUpkeep: 300_000, - MinConfirmations: 0, - MaxUpkeepBatchSize: 1, - }) - if err != nil { - return contracts.OCRv2Config{}, err - } - - signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = ocr3.ContractSetConfigArgsForTests( - 10*time.Second, // deltaProgress time.Duration, - 15*time.Second, // deltaResend time.Duration, - 500*time.Millisecond, // deltaInitial time.Duration, - 1000*time.Millisecond, // deltaRound time.Duration, - 200*time.Millisecond, // deltaGrace time.Duration, - 300*time.Millisecond, // deltaCertifiedCommitRequest time.Duration - deltaStage, // deltaStage time.Duration, - 24, // rMax uint64, - S, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - offC, // reportingPluginConfig []byte, - nil, - 20*time.Millisecond, // maxDurationQuery time.Duration, - 20*time.Millisecond, // maxDurationObservation time.Duration, // good to here - 1200*time.Millisecond, // maxDurationShouldAcceptAttestedReport time.Duration, - 20*time.Millisecond, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - nil, // onchainConfig []byte, - ) - if err != nil { - return contracts.OCRv2Config{}, err - } - } else { - offC, err = json.Marshal(ocr2keepers20config.OffchainConfig{ - TargetProbability: "0.999", - TargetInRounds: 1, - PerformLockoutWindow: 3600000, // Intentionally set to be higher than in prod for testing purpose - GasLimitPerReport: 5_300_000, - GasOverheadPerUpkeep: 300_000, - SamplingJobDuration: 3000, - MinConfirmations: 0, - MaxUpkeepBatchSize: 1, - }) - if err != nil { - return contracts.OCRv2Config{}, err - } - - signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = ocr2.ContractSetConfigArgsForTests( - 10*time.Second, // deltaProgress time.Duration, - 15*time.Second, // deltaResend time.Duration, - 3000*time.Millisecond, // deltaRound time.Duration, - 200*time.Millisecond, // deltaGrace time.Duration, - deltaStage, // deltaStage time.Duration, - 24, // rMax uint8, - S, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - offC, // reportingPluginConfig []byte, - nil, - 20*time.Millisecond, // maxDurationQuery time.Duration, - 20*time.Millisecond, // maxDurationObservation time.Duration, - 1200*time.Millisecond, // maxDurationReport time.Duration, - 20*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration, - 20*time.Millisecond, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - nil, // onchainConfig []byte, - ) - if err != nil { - return contracts.OCRv2Config{}, err - } - } - - var signers []common.Address - for _, signer := range signerOnchainPublicKeys { - if len(signer) != 20 { - return contracts.OCRv2Config{}, fmt.Errorf("OnChainPublicKey '%v' has wrong length for address", signer) - } - signers = append(signers, common.BytesToAddress(signer)) - } - - var transmitters []common.Address - for _, transmitter := range transmitterAccounts { - if !common.IsHexAddress(string(transmitter)) { - return contracts.OCRv2Config{}, fmt.Errorf("TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) - } - transmitters = append(transmitters, common.HexToAddress(string(transmitter))) - } - - ocrConfig := contracts.OCRv2Config{ - Signers: signers, - Transmitters: transmitters, - F: f, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: offchainConfig, - } - - switch registryConfig.RegistryVersion { - case ethereum.RegistryVersion_2_0: - ocrConfig.OnchainConfig = registryConfig.Encode20OnchainConfig(registrar) - case ethereum.RegistryVersion_2_1: - ocrConfig.TypedOnchainConfig21 = registryConfig.Create21OnchainConfig(registrar, registryOwnerAddress) - case ethereum.RegistryVersion_2_2: - ocrConfig.TypedOnchainConfig22 = registryConfig.Create22OnchainConfig(registrar, registryOwnerAddress, chainModuleAddress, reorgProtectionEnabled) - } - - l.Info().Msg("Done building OCR config") - return ocrConfig, nil -} - -// CreateOCRKeeperJobs bootstraps the first node and to the other nodes sends ocr jobs -func CreateOCRKeeperJobsLocal( - l zerolog.Logger, - chainlinkNodes []*nodeclient.ChainlinkClient, - registryAddr string, - chainID int64, - keyIndex int, - registryVersion ethereum.KeeperRegistryVersion, -) error { - bootstrapNode := chainlinkNodes[0] - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - l.Error().Err(err).Msg("Shouldn't fail reading P2P keys from bootstrap node") - return err - } - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - - var contractVersion string - switch registryVersion { - case ethereum.RegistryVersion_2_2: - contractVersion = "v2.1+" - case ethereum.RegistryVersion_2_1: - contractVersion = "v2.1" - case ethereum.RegistryVersion_2_0: - contractVersion = "v2.0" - default: - return errors.New("v2.0, v2.1, and v2.2 are the only supported versions") - } - - bootstrapSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2 bootstrap node " + registryAddr, - JobType: "bootstrap", - OCR2OracleSpec: job.OCR2OracleSpec{ - ContractID: registryAddr, - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": int(chainID), - }, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(time.Second * 15), - }, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - l.Error().Err(err).Msg("Shouldn't fail creating bootstrap job on bootstrap node") - return err - } - - P2Pv2Bootstrapper := fmt.Sprintf("%s@%s:%d", bootstrapP2PId, bootstrapNode.InternalIP(), 6690) - for nodeIndex := 1; nodeIndex < len(chainlinkNodes); nodeIndex++ { - nodeTransmitterAddress, err := chainlinkNodes[nodeIndex].EthAddresses() - if err != nil { - l.Error().Err(err).Msgf("Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) - return err - } - nodeOCRKeys, err := chainlinkNodes[nodeIndex].MustReadOCR2Keys() - if err != nil { - l.Error().Err(err).Msgf("Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) - return err - } - var nodeOCRKeyId []string - for _, key := range nodeOCRKeys.Data { - if key.Attributes.ChainType == string(corekeys.EVM) { - nodeOCRKeyId = append(nodeOCRKeyId, key.ID) - break - } - } - - autoOCR2JobSpec := nodeclient.OCR2TaskJobSpec{ - Name: "ocr2 " + registryAddr, - JobType: "offchainreporting2", - OCR2OracleSpec: job.OCR2OracleSpec{ - PluginType: "ocr2automation", - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": int(chainID), - }, - PluginConfig: map[string]any{ - "mercuryCredentialName": "\"cred1\"", - "contractVersion": "\"" + contractVersion + "\"", - }, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(time.Second * 15), - ContractID: registryAddr, // registryAddr - OCRKeyBundleID: null.StringFrom(nodeOCRKeyId[0]), // get node ocr2config.ID - TransmitterID: null.StringFrom(nodeTransmitterAddress[keyIndex]), // node addr - P2PV2Bootstrappers: pq.StringArray{P2Pv2Bootstrapper}, // bootstrap node key and address @bootstrap:8000 - }, - } - - _, err = chainlinkNodes[nodeIndex].MustCreateJob(&autoOCR2JobSpec) - if err != nil { - l.Error().Err(err).Msgf("Shouldn't fail creating OCR Task job on OCR node %d err: %+v", nodeIndex+1, err) - return err - } - } - l.Info().Msg("Done creating OCR automation jobs") - return nil -} diff --git a/integration-tests/actions/automationv2/actions.go b/integration-tests/actions/automationv2/actions.go deleted file mode 100644 index 3157de63397..00000000000 --- a/integration-tests/actions/automationv2/actions.go +++ /dev/null @@ -1,986 +0,0 @@ -package automationv2 - -import ( - "context" - "crypto/ed25519" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "math" - "math/big" - "strconv" - "strings" - "testing" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/lib/pq" - "github.com/rs/zerolog" - "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - ocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" - "gopkg.in/guregu/null.v4" - - ocr2keepers20config "github.com/smartcontractkit/chainlink-automation/pkg/v2/config" - ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config" - "github.com/smartcontractkit/chainlink-common/keystore/corekeys" - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - ctf_concurrency "github.com/smartcontractkit/chainlink-testing-framework/lib/concurrency" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - tt "github.com/smartcontractkit/chainlink/integration-tests/types" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registrar_wrapper2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registrar_wrapper2_0" - "github.com/smartcontractkit/chainlink-evm/pkg/utils" - "github.com/smartcontractkit/chainlink/v2/core/services/job" -) - -type NodeDetails struct { - P2PId string - TransmitterAddresses []string - OCR2ConfigPublicKey string - OCR2OffchainPublicKey string - OCR2OnChainPublicKey string - OCR2Id string -} - -type AutomationTest struct { - ChainClient *seth.Client - - TestConfig tt.AutomationTestConfig - - LinkToken contracts.LinkToken - Transcoder contracts.UpkeepTranscoder - LINKETHFeed contracts.MockLINKETHFeed - ETHUSDFeed contracts.MockETHUSDFeed - LINKUSDFeed contracts.MockETHUSDFeed - WETHToken contracts.WETHToken - GasFeed contracts.MockGasFeed - Registry contracts.KeeperRegistry - Registrar contracts.KeeperRegistrar - - RegistrySettings contracts.KeeperRegistrySettings - RegistrarSettings contracts.KeeperRegistrarSettings - PluginConfig ocr2keepers30config.OffchainConfig - PublicConfig ocr3.PublicConfig - UpkeepPrivilegeManager common.Address - UpkeepIDs []*big.Int - - IsOnk8s bool - - ChainlinkNodesk8s []*nodeclient.ChainlinkK8sClient - ChainlinkNodes []*nodeclient.ChainlinkClient - - DockerEnv *test_env.CLClusterTestEnv - - NodeDetails []NodeDetails - DefaultP2Pv2Bootstrapper string - mercuryCredentialName string - TransmitterKeyIndex int - - Logger zerolog.Logger -} - -type UpkeepConfig struct { - UpkeepName string - EncryptedEmail []byte - UpkeepContract common.Address - GasLimit uint32 - AdminAddress common.Address - TriggerType uint8 - CheckData []byte - TriggerConfig []byte - OffchainConfig []byte - FundingAmount *big.Int -} - -func NewAutomationTestK8s( - l zerolog.Logger, - chainClient *seth.Client, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - config tt.AutomationTestConfig, -) *AutomationTest { - return &AutomationTest{ - ChainClient: chainClient, - TestConfig: config, - ChainlinkNodesk8s: chainlinkNodes, - IsOnk8s: true, - TransmitterKeyIndex: 0, - UpkeepPrivilegeManager: chainClient.MustGetRootKeyAddress(), - mercuryCredentialName: "", - Logger: l, - } -} - -func NewAutomationTestDocker( - l zerolog.Logger, - chainClient *seth.Client, - chainlinkNodes []*nodeclient.ChainlinkClient, - config tt.AutomationTestConfig, -) *AutomationTest { - return &AutomationTest{ - ChainClient: chainClient, - TestConfig: config, - ChainlinkNodes: chainlinkNodes, - IsOnk8s: false, - TransmitterKeyIndex: 0, - UpkeepPrivilegeManager: chainClient.MustGetRootKeyAddress(), - mercuryCredentialName: "", - Logger: l, - } -} - -func (a *AutomationTest) SetIsOnk8s(flag bool) { - a.IsOnk8s = flag -} - -func (a *AutomationTest) SetMercuryCredentialName(name string) { - a.mercuryCredentialName = name -} - -func (a *AutomationTest) SetTransmitterKeyIndex(index int) { - a.TransmitterKeyIndex = index -} - -func (a *AutomationTest) SetUpkeepPrivilegeManager(address string) { - a.UpkeepPrivilegeManager = common.HexToAddress(address) -} - -func (a *AutomationTest) SetDockerEnv(env *test_env.CLClusterTestEnv) { - a.DockerEnv = env -} - -func (a *AutomationTest) DeployLINK() error { - linkToken, err := contracts.DeployLinkTokenContract(a.Logger, a.ChainClient) - if err != nil { - return err - } - a.LinkToken = linkToken - return nil -} - -func (a *AutomationTest) LoadLINK(address string) error { - linkToken, err := contracts.LoadLinkTokenContract(a.Logger, a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.LinkToken = linkToken - a.Logger.Info().Str("LINK Token Address", a.LinkToken.Address()).Msg("Successfully loaded LINK Token") - return nil -} - -func (a *AutomationTest) DeployTranscoder() error { - transcoder, err := contracts.DeployUpkeepTranscoder(a.ChainClient) - if err != nil { - return err - } - a.Transcoder = transcoder - return nil -} - -func (a *AutomationTest) LoadTranscoder(address string) error { - transcoder, err := contracts.LoadUpkeepTranscoder(a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.Transcoder = transcoder - a.Logger.Info().Str("Transcoder Address", a.Transcoder.Address()).Msg("Successfully loaded Transcoder") - return nil -} - -func (a *AutomationTest) DeployLinkEthFeed() error { - ethLinkFeed, err := contracts.DeployMockLINKETHFeed(a.ChainClient, a.RegistrySettings.FallbackLinkPrice) - if err != nil { - return err - } - a.LINKETHFeed = ethLinkFeed - return nil -} - -func (a *AutomationTest) LoadLinkEthFeed(address string) error { - ethLinkFeed, err := contracts.LoadMockLINKETHFeed(a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.LINKETHFeed = ethLinkFeed - a.Logger.Info().Str("LINK/ETH Feed Address", a.LINKETHFeed.Address()).Msg("Successfully loaded LINK/ETH Feed") - return nil -} - -func (a *AutomationTest) DeployEthUSDFeed() error { - ethUSDFeed, err := contracts.DeployMockETHUSDFeed(a.ChainClient, a.RegistrySettings.FallbackLinkPrice) - if err != nil { - return err - } - a.ETHUSDFeed = ethUSDFeed - return nil -} - -func (a *AutomationTest) LoadEthUSDFeed(address string) error { - ethUSDFeed, err := contracts.LoadMockETHUSDFeed(a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.ETHUSDFeed = ethUSDFeed - a.Logger.Info().Str("ETH/USD Feed Address", a.ETHUSDFeed.Address()).Msg("Successfully loaded ETH/USD Feed") - return nil -} - -func (a *AutomationTest) DeployLinkUSDFeed() error { - linkUSDFeed, err := contracts.DeployMockETHUSDFeed(a.ChainClient, a.RegistrySettings.FallbackLinkPrice) - if err != nil { - return err - } - a.LINKUSDFeed = linkUSDFeed - return nil -} - -func (a *AutomationTest) LoadLinkUSDFeed(address string) error { - linkUSDFeed, err := contracts.LoadMockETHUSDFeed(a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.LINKUSDFeed = linkUSDFeed - a.Logger.Info().Str("LINK/USD Feed Address", a.LINKUSDFeed.Address()).Msg("Successfully loaded LINK/USD Feed") - return nil -} - -func (a *AutomationTest) DeployWETH() error { - wethToken, err := contracts.DeployWETHTokenContract(a.Logger, a.ChainClient) - if err != nil { - return err - } - a.WETHToken = wethToken - return nil -} - -func (a *AutomationTest) LoadWETH(address string) error { - wethToken, err := contracts.LoadWETHTokenContract(a.Logger, a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.WETHToken = wethToken - a.Logger.Info().Str("WETH Token Address", a.WETHToken.Address()).Msg("Successfully loaded WETH Token") - return nil -} - -func (a *AutomationTest) DeployGasFeed() error { - gasFeed, err := contracts.DeployMockGASFeed(a.ChainClient, a.RegistrySettings.FallbackGasPrice) - if err != nil { - return err - } - a.GasFeed = gasFeed - return nil -} - -func (a *AutomationTest) LoadEthGasFeed(address string) error { - gasFeed, err := contracts.LoadMockGASFeed(a.ChainClient, common.HexToAddress(address)) - if err != nil { - return err - } - a.GasFeed = gasFeed - a.Logger.Info().Str("Gas Feed Address", a.GasFeed.Address()).Msg("Successfully loaded Gas Feed") - return nil -} - -func (a *AutomationTest) DeployRegistry() error { - registryOpts := &contracts.KeeperRegistryOpts{ - RegistryVersion: a.RegistrySettings.RegistryVersion, - LinkAddr: a.LinkToken.Address(), - ETHFeedAddr: a.LINKETHFeed.Address(), - GasFeedAddr: a.GasFeed.Address(), - TranscoderAddr: a.Transcoder.Address(), - RegistrarAddr: utils.ZeroAddress.Hex(), - Settings: a.RegistrySettings, - LinkUSDFeedAddr: a.ETHUSDFeed.Address(), - NativeUSDFeedAddr: a.LINKUSDFeed.Address(), - WrappedNativeAddr: a.WETHToken.Address(), - } - registry, err := contracts.DeployKeeperRegistry(a.ChainClient, registryOpts) - if err != nil { - return err - } - a.Registry = registry - return nil -} - -func (a *AutomationTest) LoadRegistry(registryAddress, chainModuleAddress string) error { - registry, err := contracts.LoadKeeperRegistry(a.Logger, a.ChainClient, common.HexToAddress(registryAddress), a.RegistrySettings.RegistryVersion, common.HexToAddress(chainModuleAddress)) - if err != nil { - return err - } - a.Registry = registry - a.Logger.Info().Str("ChainModule Address", chainModuleAddress).Str("Registry Address", a.Registry.Address()).Msg("Successfully loaded Registry") - return nil -} - -func (a *AutomationTest) DeployRegistrar() error { - if a.Registry == nil { - return errors.New("registry must be deployed or loaded before registrar") - } - a.RegistrarSettings.RegistryAddr = a.Registry.Address() - a.RegistrarSettings.WETHTokenAddr = a.WETHToken.Address() - registrar, err := contracts.DeployKeeperRegistrar(a.ChainClient, a.RegistrySettings.RegistryVersion, a.LinkToken.Address(), a.RegistrarSettings) - if err != nil { - return err - } - a.Registrar = registrar - return nil -} - -func (a *AutomationTest) LoadRegistrar(address string) error { - if a.Registry == nil { - return errors.New("registry must be deployed or loaded before registrar") - } - a.RegistrarSettings.RegistryAddr = a.Registry.Address() - registrar, err := contracts.LoadKeeperRegistrar(a.ChainClient, common.HexToAddress(address), a.RegistrySettings.RegistryVersion) - if err != nil { - return err - } - a.Logger.Info().Str("Registrar Address", registrar.Address()).Msg("Successfully loaded Registrar") - a.Registrar = registrar - return nil -} - -func (a *AutomationTest) CollectNodeDetails() error { - var ( - nodes []*nodeclient.ChainlinkClient - ) - if a.IsOnk8s { - for _, node := range a.ChainlinkNodesk8s { - nodes = append(nodes, node.ChainlinkClient) - } - a.ChainlinkNodes = nodes - } else { - nodes = a.ChainlinkNodes - } - - nodeDetails := make([]NodeDetails, 0) - - for i, node := range nodes { - nodeDetail := NodeDetails{} - P2PIds, err := node.MustReadP2PKeys() - if err != nil { - return errors.Join(err, fmt.Errorf("failed to read P2P keys from node %d", i)) - } - nodeDetail.P2PId = P2PIds.Data[0].Attributes.PeerID - - OCR2Keys, err := node.MustReadOCR2Keys() - if err != nil { - return errors.Join(err, fmt.Errorf("failed to read OCR2 keys from node %d", i)) - } - for _, key := range OCR2Keys.Data { - if key.Attributes.ChainType == string(corekeys.EVM) { - nodeDetail.OCR2ConfigPublicKey = key.Attributes.ConfigPublicKey - nodeDetail.OCR2OffchainPublicKey = key.Attributes.OffChainPublicKey - nodeDetail.OCR2OnChainPublicKey = key.Attributes.OnChainPublicKey - nodeDetail.OCR2Id = key.ID - break - } - } - - TransmitterKeys, err := node.EthAddressesForChain(strconv.FormatInt(a.ChainClient.ChainID, 10)) - nodeDetail.TransmitterAddresses = make([]string, 0) - if err != nil { - return errors.Join(err, fmt.Errorf("failed to read Transmitter keys from node %d", i)) - } - nodeDetail.TransmitterAddresses = append(nodeDetail.TransmitterAddresses, TransmitterKeys...) - nodeDetails = append(nodeDetails, nodeDetail) - } - a.NodeDetails = nodeDetails - - if a.IsOnk8s { - a.DefaultP2Pv2Bootstrapper = fmt.Sprintf("%s@%s-node-1:%d", a.NodeDetails[0].P2PId, a.ChainlinkNodesk8s[0].Name(), 6690) - } else { - a.DefaultP2Pv2Bootstrapper = fmt.Sprintf("%s@%s:%d", a.NodeDetails[0].P2PId, a.ChainlinkNodes[0].InternalIP(), 6690) - } - return nil -} - -func (a *AutomationTest) AddBootstrapJob() error { - bootstrapSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2 bootstrap node " + a.Registry.Address(), - JobType: "bootstrap", - OCR2OracleSpec: job.OCR2OracleSpec{ - ContractID: a.Registry.Address(), - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": int(a.ChainClient.ChainID), - }, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(time.Second * 15), - }, - } - _, err := a.ChainlinkNodes[0].MustCreateJob(bootstrapSpec) - if err != nil { - return errors.Join(err, errors.New("failed to create bootstrap job on bootstrap node")) - } - return nil -} - -func (a *AutomationTest) AddAutomationJobs() error { - var contractVersion string - switch a.RegistrySettings.RegistryVersion { - case ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - contractVersion = "v2.1+" - case ethereum.RegistryVersion_2_1: - contractVersion = "v2.1" - case ethereum.RegistryVersion_2_0: - contractVersion = "v2.0" - default: - return errors.New("v2.0, v2.1, v2.2 and v2.3 are the only supported versions") - } - pluginCfg := map[string]any{ - "contractVersion": "\"" + contractVersion + "\"", - } - if strings.Contains(contractVersion, "v2.1") { - if a.mercuryCredentialName != "" { - pluginCfg["mercuryCredentialName"] = "\"" + a.mercuryCredentialName + "\"" - } - } - for i := 1; i < len(a.ChainlinkNodes); i++ { - autoOCR2JobSpec := nodeclient.OCR2TaskJobSpec{ - Name: "automation-" + contractVersion + "-" + a.Registry.Address(), - JobType: "offchainreporting2", - OCR2OracleSpec: job.OCR2OracleSpec{ - PluginType: "ocr2automation", - ContractID: a.Registry.Address(), - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": int(a.ChainClient.ChainID), - }, - PluginConfig: pluginCfg, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(time.Second * 15), - TransmitterID: null.StringFrom(a.NodeDetails[i].TransmitterAddresses[a.TransmitterKeyIndex]), - P2PV2Bootstrappers: pq.StringArray{a.DefaultP2Pv2Bootstrapper}, - OCRKeyBundleID: null.StringFrom(a.NodeDetails[i].OCR2Id), - }, - } - _, err := a.ChainlinkNodes[i].MustCreateJob(&autoOCR2JobSpec) - if err != nil { - return errors.Join(err, fmt.Errorf("failed to create OCR2 job on node %d", i+1)) - } - } - return nil -} - -func (a *AutomationTest) SetConfigOnRegistry() error { - donNodes := a.NodeDetails[1:] - S := make([]int, len(donNodes)) - oracleIdentities := make([]confighelper.OracleIdentityExtra, len(donNodes)) - var signerOnchainPublicKeys []types.OnchainPublicKey - var transmitterAccounts []types.Account - var f uint8 - var offchainConfigVersion uint64 - var offchainConfig []byte - sharedSecretEncryptionPublicKeys := make([]types.ConfigEncryptionPublicKey, len(donNodes)) - eg := &errgroup.Group{} - for i, donNode := range donNodes { - index, chainlinkNode := i, donNode - eg.Go(func() error { - offchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(chainlinkNode.OCR2OffchainPublicKey, "ocr2off_evm_")) - if err != nil { - return err - } - - offchainPkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(offchainPkBytesFixed[:], offchainPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - configPkBytes, err := hex.DecodeString(strings.TrimPrefix(chainlinkNode.OCR2ConfigPublicKey, "ocr2cfg_evm_")) - if err != nil { - return err - } - - configPkBytesFixed := [ed25519.PublicKeySize]byte{} - n = copy(configPkBytesFixed[:], configPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - onchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(chainlinkNode.OCR2OnChainPublicKey, "ocr2on_evm_")) - if err != nil { - return err - } - - sharedSecretEncryptionPublicKeys[index] = configPkBytesFixed - oracleIdentities[index] = confighelper.OracleIdentityExtra{ - OracleIdentity: confighelper.OracleIdentity{ - OnchainPublicKey: onchainPkBytes, - OffchainPublicKey: offchainPkBytesFixed, - PeerID: chainlinkNode.P2PId, - TransmitAccount: types.Account(chainlinkNode.TransmitterAddresses[a.TransmitterKeyIndex]), - }, - ConfigEncryptionPublicKey: configPkBytesFixed, - } - S[index] = 1 - return nil - }) - } - err := eg.Wait() - if err != nil { - return errors.Join(err, errors.New("failed to build oracle identities")) - } - - switch a.RegistrySettings.RegistryVersion { - case ethereum.RegistryVersion_2_0: - signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = calculateOCR2ConfigArgs(a, S, oracleIdentities) - if err != nil { - return errors.Join(err, errors.New("failed to build config args")) - } - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = calculateOCR3ConfigArgs(a, S, oracleIdentities) - if err != nil { - return errors.Join(err, errors.New("failed to build config args")) - } - default: - return errors.New("v2.0, v2.1, v2.2 and v2.3 are the only supported versions") - } - - var signers []common.Address - for _, signer := range signerOnchainPublicKeys { - if len(signer) != 20 { - return fmt.Errorf("OnChainPublicKey '%v' has wrong length for address", signer) - } - signers = append(signers, common.BytesToAddress(signer)) - } - - var transmitters []common.Address - for _, transmitter := range transmitterAccounts { - if !common.IsHexAddress(string(transmitter)) { - return fmt.Errorf("TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) - } - transmitters = append(transmitters, common.HexToAddress(string(transmitter))) - } - - ocrConfig := contracts.OCRv2Config{ - Signers: signers, - Transmitters: transmitters, - F: f, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: offchainConfig, - } - - if a.RegistrySettings.RegistryVersion == ethereum.RegistryVersion_2_0 { - ocrConfig.OnchainConfig = a.RegistrySettings.Encode20OnchainConfig(a.Registrar.Address()) - err = a.Registry.SetConfig(a.RegistrySettings, ocrConfig) - if err != nil { - return errors.Join(err, errors.New("failed to set config on registry")) - } - } else { - switch a.RegistrySettings.RegistryVersion { - case ethereum.RegistryVersion_2_1: - ocrConfig.TypedOnchainConfig21 = a.RegistrySettings.Create21OnchainConfig(a.Registrar.Address(), a.UpkeepPrivilegeManager) - case ethereum.RegistryVersion_2_2: - ocrConfig.TypedOnchainConfig22 = a.RegistrySettings.Create22OnchainConfig(a.Registrar.Address(), a.UpkeepPrivilegeManager, a.Registry.ChainModuleAddress(), a.Registry.ReorgProtectionEnabled()) - case ethereum.RegistryVersion_2_3: - ocrConfig.TypedOnchainConfig23 = a.RegistrySettings.Create23OnchainConfig(a.Registrar.Address(), a.UpkeepPrivilegeManager, a.Registry.ChainModuleAddress(), a.Registry.ReorgProtectionEnabled()) - ocrConfig.BillingTokens = []common.Address{ - common.HexToAddress(a.LinkToken.Address()), - common.HexToAddress(a.WETHToken.Address()), - } - - ocrConfig.BillingConfigs = []i_automation_registry_master_wrapper_2_3.AutomationRegistryBase23BillingConfig{ - { - GasFeePPB: 100, - FlatFeeMilliCents: big.NewInt(500), - PriceFeed: common.HexToAddress(a.ETHUSDFeed.Address()), - Decimals: 18, - FallbackPrice: big.NewInt(1000), - MinSpend: big.NewInt(200), - }, - { - GasFeePPB: 100, - FlatFeeMilliCents: big.NewInt(500), - PriceFeed: common.HexToAddress(a.LINKUSDFeed.Address()), - Decimals: 18, - FallbackPrice: big.NewInt(1000), - MinSpend: big.NewInt(200), - }, - } - } - a.Logger.Debug().Interface("ocrConfig", ocrConfig).Msg("Setting OCR3 config") - err = a.Registry.SetConfigTypeSafe(ocrConfig) - if err != nil { - return errors.Join(err, errors.New("failed to set config on registry")) - } - } - return nil -} - -func calculateOCR2ConfigArgs(a *AutomationTest, S []int, oracleIdentities []confighelper.OracleIdentityExtra) ( - signers []types.OnchainPublicKey, - transmitters []types.Account, - f_ uint8, - onchainConfig_ []byte, - offchainConfigVersion uint64, - offchainConfig []byte, - err error, -) { - offC, _ := json.Marshal(ocr2keepers20config.OffchainConfig{ - TargetProbability: a.PluginConfig.TargetProbability, - TargetInRounds: a.PluginConfig.TargetInRounds, - PerformLockoutWindow: a.PluginConfig.PerformLockoutWindow, - GasLimitPerReport: a.PluginConfig.GasLimitPerReport, - GasOverheadPerUpkeep: a.PluginConfig.GasOverheadPerUpkeep, - MinConfirmations: a.PluginConfig.MinConfirmations, - MaxUpkeepBatchSize: a.PluginConfig.MaxUpkeepBatchSize, - }) - - rMax := a.PublicConfig.RMax - if rMax > math.MaxUint8 { - panic(fmt.Errorf("rmax overflows uint8: %d", rMax)) - } - - return ocr2.ContractSetConfigArgsForTests( - a.PublicConfig.DeltaProgress, a.PublicConfig.DeltaResend, - a.PublicConfig.DeltaRound, a.PublicConfig.DeltaGrace, - a.PublicConfig.DeltaStage, uint8(rMax), - S, oracleIdentities, offC, - nil, - a.PublicConfig.MaxDurationQuery, a.PublicConfig.MaxDurationObservation, - 1200*time.Millisecond, - a.PublicConfig.MaxDurationShouldAcceptAttestedReport, - a.PublicConfig.MaxDurationShouldTransmitAcceptedReport, - a.PublicConfig.F, a.PublicConfig.OnchainConfig, - ) -} - -func calculateOCR3ConfigArgs(a *AutomationTest, S []int, oracleIdentities []confighelper.OracleIdentityExtra) ( - signers []types.OnchainPublicKey, - transmitters []types.Account, - f_ uint8, - onchainConfig_ []byte, - offchainConfigVersion uint64, - offchainConfig []byte, - err error, -) { - offC, _ := json.Marshal(a.PluginConfig) - - return ocr3.ContractSetConfigArgsForTests( - a.PublicConfig.DeltaProgress, a.PublicConfig.DeltaResend, a.PublicConfig.DeltaInitial, - a.PublicConfig.DeltaRound, a.PublicConfig.DeltaGrace, a.PublicConfig.DeltaCertifiedCommitRequest, - a.PublicConfig.DeltaStage, a.PublicConfig.RMax, - S, oracleIdentities, offC, - nil, a.PublicConfig.MaxDurationQuery, a.PublicConfig.MaxDurationObservation, - a.PublicConfig.MaxDurationShouldAcceptAttestedReport, - a.PublicConfig.MaxDurationShouldTransmitAcceptedReport, - a.PublicConfig.F, a.PublicConfig.OnchainConfig, - ) -} - -type registrationResult struct { - txHash common.Hash -} - -func (r registrationResult) GetResult() common.Hash { - return r.txHash -} - -func (a *AutomationTest) RegisterUpkeeps(upkeepConfigs []UpkeepConfig, maxConcurrency int) ([]common.Hash, error) { - concurrency, err := actions.GetAndAssertCorrectConcurrency(a.ChainClient, 1) - if err != nil { - return nil, err - } - - if concurrency > maxConcurrency { - concurrency = maxConcurrency - a.Logger.Debug(). - Msgf("Concurrency is higher than max concurrency, setting concurrency to %d", concurrency) - } - - var registerUpkeep = func(resultCh chan registrationResult, errorCh chan error, executorNum int, upkeepConfig UpkeepConfig) { - keyNum := executorNum + 1 // key 0 is the root key - var registrationRequest []byte - var registrarABI *abi.ABI - var err error - switch a.RegistrySettings.RegistryVersion { - case ethereum.RegistryVersion_2_0: - registrarABI, err = keeper_registrar_wrapper2_0.KeeperRegistrarMetaData.GetAbi() - if err != nil { - errorCh <- errors.Join(err, errors.New("failed to get registrar abi")) - return - } - registrationRequest, err = registrarABI.Pack( - "register", - upkeepConfig.UpkeepName, - upkeepConfig.EncryptedEmail, - upkeepConfig.UpkeepContract, - upkeepConfig.GasLimit, - upkeepConfig.AdminAddress, - upkeepConfig.CheckData, - upkeepConfig.OffchainConfig, - upkeepConfig.FundingAmount, - a.ChainClient.Addresses[keyNum]) - if err != nil { - errorCh <- errors.Join(err, errors.New("failed to pack registrar request")) - return - } - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2: // 2.1 and 2.2 use the same registrar - registrarABI, err = automation_registrar_wrapper2_1.AutomationRegistrarMetaData.GetAbi() - if err != nil { - errorCh <- errors.Join(err, errors.New("failed to get registrar abi")) - return - } - registrationRequest, err = registrarABI.Pack( - "register", - upkeepConfig.UpkeepName, - upkeepConfig.EncryptedEmail, - upkeepConfig.UpkeepContract, - upkeepConfig.GasLimit, - upkeepConfig.AdminAddress, - upkeepConfig.TriggerType, - upkeepConfig.CheckData, - upkeepConfig.TriggerConfig, - upkeepConfig.OffchainConfig, - upkeepConfig.FundingAmount, - a.ChainClient.Addresses[keyNum]) - if err != nil { - errorCh <- errors.Join(err, errors.New("failed to pack registrar request")) - return - } - default: - errorCh <- errors.New("v2.0, v2.1, and v2.2 are the only supported versions") - return - } - - tx, err := a.LinkToken.TransferAndCallFromKey(a.Registrar.Address(), upkeepConfig.FundingAmount, registrationRequest, keyNum) - if err != nil { - errorCh <- errors.Join(err, fmt.Errorf("client number %d failed to register upkeep %s", keyNum, upkeepConfig.UpkeepContract.Hex())) - return - } - - resultCh <- registrationResult{txHash: tx.Hash()} - } - - executor := ctf_concurrency.NewConcurrentExecutor[common.Hash, registrationResult, UpkeepConfig](a.Logger) - results, err := executor.Execute(concurrency, upkeepConfigs, registerUpkeep) - if err != nil { - return nil, err - } - - if len(results) != len(upkeepConfigs) { - return nil, fmt.Errorf("failed to register all upkeeps. Expected %d, got %d", len(upkeepConfigs), len(results)) - } - - a.Logger.Info().Msg("Successfully registered all upkeeps") - - return results, nil -} - -type UpkeepId = *big.Int - -type confirmationResult struct { - upkeepID UpkeepId -} - -func (c confirmationResult) GetResult() UpkeepId { - return c.upkeepID -} - -func (a *AutomationTest) ConfirmUpkeepsRegistered(registrationTxHashes []common.Hash, maxConcurrency int) ([]*big.Int, error) { - concurrency, err := actions.GetAndAssertCorrectConcurrency(a.ChainClient, 1) - if err != nil { - return nil, err - } - - if concurrency > maxConcurrency { - concurrency = maxConcurrency - a.Logger.Debug(). - Msgf("Concurrency is higher than max concurrency, setting concurrency to %d", concurrency) - } - - var confirmUpkeep = func(resultCh chan confirmationResult, errorCh chan error, _ int, txHash common.Hash) { - receipt, err := a.ChainClient.Client.TransactionReceipt(context.Background(), txHash) - if err != nil { - errorCh <- errors.Join(err, errors.New("failed to confirm upkeep registration")) - return - } - - var upkeepId *big.Int - for _, rawLog := range receipt.Logs { - parsedUpkeepId, err := a.Registry.ParseUpkeepIdFromRegisteredLog(rawLog) - if err == nil { - upkeepId = parsedUpkeepId - break - } - } - if upkeepId == nil { - errorCh <- errors.New("failed to parse upkeep id from registration receipt") - return - } - resultCh <- confirmationResult{upkeepID: upkeepId} - } - - executor := ctf_concurrency.NewConcurrentExecutor[UpkeepId, confirmationResult, common.Hash](a.Logger) - results, err := executor.Execute(concurrency, registrationTxHashes, confirmUpkeep) - - if err != nil { - return nil, fmt.Errorf("failed confirmations: %d | successful confirmations: %d", len(executor.GetErrors()), len(results)) - } - - if len(registrationTxHashes) != len(results) { - return nil, fmt.Errorf("failed to confirm all upkeeps. Expected %d, got %d", len(registrationTxHashes), len(results)) - } - - seen := make(map[*big.Int]bool) - for _, upkeepId := range results { - if seen[upkeepId] { - return nil, fmt.Errorf("duplicate upkeep id: %s. Something went wrong during upkeep confirmation. Please check the test code", upkeepId.String()) - } - seen[upkeepId] = true - } - - a.Logger.Info().Msg("Successfully confirmed all upkeeps") - a.UpkeepIDs = results - - return results, nil -} - -func (a *AutomationTest) AddJobsAndSetConfig(t *testing.T) { - l := logging.GetTestLogger(t) - err := a.AddBootstrapJob() - require.NoError(t, err, "Error adding bootstrap job") - err = a.AddAutomationJobs() - require.NoError(t, err, "Error adding automation jobs") - - l.Info(). - Interface("Plugin Config", a.PluginConfig). - Interface("Public Config", a.PublicConfig). - Interface("Registry Settings", a.RegistrySettings). - Interface("Registrar Settings", a.RegistrarSettings). - Msg("Configuring registry") - err = a.SetConfigOnRegistry() - require.NoError(t, err, "Error setting config on registry") - l.Info().Str("Registry Address", a.Registry.Address()).Msg("Successfully setConfig on registry") -} - -func (a *AutomationTest) SetupAutomationDeployment(t *testing.T) { - a.setupDeployment(t, true) -} - -func (a *AutomationTest) SetupAutomationDeploymentWithoutJobs(t *testing.T) { - a.setupDeployment(t, false) -} - -func (a *AutomationTest) setupDeployment(t *testing.T, addJobs bool) { - l := logging.GetTestLogger(t) - err := a.CollectNodeDetails() - require.NoError(t, err, "Error collecting node details") - l.Info().Msg("Collected Node Details") - l.Debug().Interface("Node Details", a.NodeDetails).Msg("Node Details") - - if a.TestConfig.GetAutomationConfig().UseExistingLinkTokenContract() { - linkAddress, err := a.TestConfig.GetAutomationConfig().LinkTokenContractAddress() - require.NoError(t, err, "Error getting link token contract address") - err = a.LoadLINK(linkAddress.String()) - require.NoError(t, err, "Error loading link token contract") - } else { - err = a.DeployLINK() - require.NoError(t, err, "Error deploying link token contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingWethContract() { - wethAddress, err := a.TestConfig.GetAutomationConfig().WethContractAddress() - require.NoError(t, err, "Error getting weth token contract address") - err = a.LoadWETH(wethAddress.String()) - require.NoError(t, err, "Error loading weth token contract") - } else { - err = a.DeployWETH() - require.NoError(t, err, "Error deploying weth token contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingLinkEthFeedContract() { - linkEthFeedAddress, err := a.TestConfig.GetAutomationConfig().LinkEthFeedContractAddress() - require.NoError(t, err, "Error getting link eth feed contract address") - err = a.LoadLinkEthFeed(linkEthFeedAddress.String()) - require.NoError(t, err, "Error loading link eth feed contract") - } else { - err = a.DeployLinkEthFeed() - require.NoError(t, err, "Error deploying link eth feed contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingEthGasFeedContract() { - gasFeedAddress, err := a.TestConfig.GetAutomationConfig().EthGasFeedContractAddress() - require.NoError(t, err, "Error getting gas feed contract address") - err = a.LoadEthGasFeed(gasFeedAddress.String()) - require.NoError(t, err, "Error loading gas feed contract") - } else { - err = a.DeployGasFeed() - require.NoError(t, err, "Error deploying gas feed contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingEthUSDFeedContract() { - ethUsdFeedAddress, err := a.TestConfig.GetAutomationConfig().EthUSDFeedContractAddress() - require.NoError(t, err, "Error getting eth usd feed contract address") - err = a.LoadEthUSDFeed(ethUsdFeedAddress.String()) - require.NoError(t, err, "Error loading eth usd feed contract") - } else { - err = a.DeployEthUSDFeed() - require.NoError(t, err, "Error deploying eth usd feed contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingLinkUSDFeedContract() { - linkUsdFeedAddress, err := a.TestConfig.GetAutomationConfig().LinkUSDFeedContractAddress() - require.NoError(t, err, "Error getting link usd feed contract address") - err = a.LoadLinkUSDFeed(linkUsdFeedAddress.String()) - require.NoError(t, err, "Error loading link usd feed contract") - } else { - err = a.DeployLinkUSDFeed() - require.NoError(t, err, "Error deploying link usd feed contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingTranscoderContract() { - transcoderAddress, err := a.TestConfig.GetAutomationConfig().TranscoderContractAddress() - require.NoError(t, err, "Error getting transcoder contract address") - err = a.LoadTranscoder(transcoderAddress.String()) - require.NoError(t, err, "Error loading transcoder contract") - } else { - err = a.DeployTranscoder() - require.NoError(t, err, "Error deploying transcoder contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingRegistryContract() { - chainModuleAddress, err := a.TestConfig.GetAutomationConfig().ChainModuleContractAddress() - require.NoError(t, err, "Error getting chain module contract address") - registryAddress, err := a.TestConfig.GetAutomationConfig().RegistryContractAddress() - require.NoError(t, err, "Error getting registry contract address") - err = a.LoadRegistry(registryAddress.String(), chainModuleAddress.String()) - require.NoError(t, err, "Error loading registry contract") - if a.Registry.RegistryOwnerAddress().String() != a.ChainClient.MustGetRootKeyAddress().String() { - l.Debug().Str("RootKeyAddress", a.ChainClient.MustGetRootKeyAddress().String()).Str("Registry Owner Address", a.Registry.RegistryOwnerAddress().String()).Msg("Registry owner address is not the root key address") - t.Error("Registry owner address is not the root key address") - t.FailNow() - } - } else { - err = a.DeployRegistry() - require.NoError(t, err, "Error deploying registry contract") - } - - if a.TestConfig.GetAutomationConfig().UseExistingRegistrarContract() { - registrarAddress, err := a.TestConfig.GetAutomationConfig().RegistrarContractAddress() - require.NoError(t, err, "Error getting registrar contract address") - err = a.LoadRegistrar(registrarAddress.String()) - require.NoError(t, err, "Error loading registrar contract") - } else { - err = a.DeployRegistrar() - require.NoError(t, err, "Error deploying registrar contract") - } - - if addJobs { - a.AddJobsAndSetConfig(t) - } -} diff --git a/integration-tests/actions/contracts.go b/integration-tests/actions/contracts.go deleted file mode 100644 index 1a50c4d7ba9..00000000000 --- a/integration-tests/actions/contracts.go +++ /dev/null @@ -1,23 +0,0 @@ -package actions - -import ( - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -// LinkTokenContract returns a link token contract instance. Depending on test configuration, it either deploys a new one or uses an existing one. -func LinkTokenContract(l zerolog.Logger, sethClient *seth.Client, configWithLinkToken tc.LinkTokenContractConfig) (*contracts.EthereumLinkToken, error) { - if configWithLinkToken != nil && configWithLinkToken.UseExistingLinkTokenContract() { - linkAddress, err := configWithLinkToken.LinkTokenContractAddress() - if err != nil { - return nil, err - } - - return contracts.LoadLinkTokenContract(l, sethClient, linkAddress) - } - return contracts.DeployLinkTokenContract(l, sethClient) -} diff --git a/integration-tests/actions/keeper_helpers.go b/integration-tests/actions/keeper_helpers.go deleted file mode 100644 index d2cf96940a2..00000000000 --- a/integration-tests/actions/keeper_helpers.go +++ /dev/null @@ -1,684 +0,0 @@ -package actions - -import ( - "context" - "fmt" - "math" - "math/big" - "strconv" - "testing" - - tt "github.com/smartcontractkit/chainlink/integration-tests/types" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/google/uuid" - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - ctf_concurrency "github.com/smartcontractkit/chainlink-testing-framework/lib/concurrency" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -var ZeroAddress = common.Address{} - -func CreateKeeperJobsWithKeyIndex( - t *testing.T, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - keeperRegistry contracts.KeeperRegistry, - keyIndex int, - ocrConfig contracts.OCRv2Config, - evmChainID string, -) { - // Send keeper jobs to registry and chainlink nodes - primaryNode := chainlinkNodes[0] - primaryNodeAddresses, err := primaryNode.EthAddresses() - require.NoError(t, err, "Reading ETH Keys from Chainlink Client shouldn't fail") - nodeAddresses, err := ChainlinkNodeAddressesAtIndex(chainlinkNodes, keyIndex) - require.NoError(t, err, "Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") - nodeAddressesStr, payees := make([]string, 0), make([]string, 0) - for _, cla := range nodeAddresses { - nodeAddressesStr = append(nodeAddressesStr, cla.Hex()) - payees = append(payees, primaryNodeAddresses[keyIndex]) - } - err = keeperRegistry.SetKeepers(nodeAddressesStr, payees, ocrConfig) - require.NoError(t, err, "Setting keepers in the registry shouldn't fail") - - for _, chainlinkNode := range chainlinkNodes { - chainlinkNodeAddress, err := chainlinkNode.EthAddresses() - require.NoError(t, err, "Error retrieving chainlink node address") - _, err = chainlinkNode.MustCreateJob(&nodeclient.KeeperJobSpec{ - Name: "keeper-test-" + keeperRegistry.Address(), - ContractAddress: keeperRegistry.Address(), - FromAddress: chainlinkNodeAddress[keyIndex], - EVMChainID: evmChainID, - MinIncomingConfirmations: 1, - }) - require.NoError(t, err, "Creating KeeperV2 Job shouldn't fail") - } -} - -func DeleteKeeperJobsWithId(t *testing.T, chainlinkNodes []*nodeclient.ChainlinkK8sClient, id int) { - for _, chainlinkNode := range chainlinkNodes { - err := chainlinkNode.MustDeleteJob(strconv.Itoa(id)) - require.NoError(t, err, "Deleting KeeperV2 Job shouldn't fail") - } -} - -// 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 DeployKeeperContracts( - t *testing.T, - registryVersion ethereum.KeeperRegistryVersion, - registrySettings contracts.KeeperRegistrySettings, - numberOfUpkeeps int, - upkeepGasLimit uint32, - linkToken contracts.LinkToken, - client *seth.Client, - linkFundsForEachUpkeep *big.Int, -) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperConsumer, []*big.Int) { - ef, err := contracts.DeployMockLINKETHFeed(client, big.NewInt(2e18)) - require.NoError(t, err, "Deploying mock ETH-Link feed shouldn't fail") - gf, err := contracts.DeployMockGASFeed(client, big.NewInt(2e11)) - require.NoError(t, err, "Deploying mock gas feed shouldn't fail") - - // Deploy the transcoder here, and then set it to the registry - transcoder, err := contracts.DeployUpkeepTranscoder(client) - require.NoError(t, err, "Deploying UpkeepTranscoder contract shouldn't fail") - - registry, err := contracts.DeployKeeperRegistry( - client, - &contracts.KeeperRegistryOpts{ - RegistryVersion: registryVersion, - LinkAddr: linkToken.Address(), - ETHFeedAddr: ef.Address(), - GasFeedAddr: gf.Address(), - TranscoderAddr: transcoder.Address(), - RegistrarAddr: ZeroAddress.Hex(), - Settings: registrySettings, - }, - ) - require.NoError(t, err, "Deploying KeeperRegistry shouldn't fail") - - // Fund the registry with 1 LINK * amount of KeeperConsumerPerformance contracts - err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(numberOfUpkeeps)))) - require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - - registrarSettings := contracts.KeeperRegistrarSettings{ - AutoApproveConfigType: 2, - AutoApproveMaxAllowed: math.MaxUint16, - RegistryAddr: registry.Address(), - MinLinkJuels: big.NewInt(0), - } - - registrar := DeployKeeperRegistrar(t, client, registryVersion, linkToken, registrarSettings, registry) - upkeeps, upkeepIds := DeployLegacyConsumers(t, client, registry, registrar, linkToken, numberOfUpkeeps, linkFundsForEachUpkeep, upkeepGasLimit, false, false, false, nil) - - return registry, registrar, upkeeps, upkeepIds -} - -// DeployPerformanceKeeperContracts deploys a set amount of keeper performance contracts registered to a single registry -func DeployPerformanceKeeperContracts( - t *testing.T, - chainClient *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - numberOfContracts int, - upkeepGasLimit uint32, - linkToken contracts.LinkToken, - registrySettings *contracts.KeeperRegistrySettings, - linkFundsForEachUpkeep *big.Int, - blockRange, // How many blocks to run the test for - blockInterval, // Interval of blocks that upkeeps are expected to be performed - checkGasToBurn, // How much gas should be burned on checkUpkeep() calls - performGasToBurn int64, // How much gas should be burned on performUpkeep() calls -) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperConsumerPerformance, []*big.Int) { - ef, err := contracts.DeployMockLINKETHFeed(chainClient, big.NewInt(2e18)) - require.NoError(t, err, "Deploying mock ETH-Link feed shouldn't fail") - gf, err := contracts.DeployMockGASFeed(chainClient, big.NewInt(2e11)) - require.NoError(t, err, "Deploying mock gas feed shouldn't fail") - - registry, err := contracts.DeployKeeperRegistry( - chainClient, - &contracts.KeeperRegistryOpts{ - RegistryVersion: registryVersion, - LinkAddr: linkToken.Address(), - ETHFeedAddr: ef.Address(), - GasFeedAddr: gf.Address(), - TranscoderAddr: ZeroAddress.Hex(), - RegistrarAddr: ZeroAddress.Hex(), - Settings: *registrySettings, - }, - ) - require.NoError(t, err, "Deploying KeeperRegistry shouldn't fail") - - // Fund the registry with 1 LINK * amount of KeeperConsumerPerformance contracts - err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(numberOfContracts)))) - require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - - registrarSettings := contracts.KeeperRegistrarSettings{ - AutoApproveConfigType: 2, - AutoApproveMaxAllowed: math.MaxUint16, - RegistryAddr: registry.Address(), - MinLinkJuels: big.NewInt(0), - } - registrar := DeployKeeperRegistrar(t, chainClient, registryVersion, linkToken, registrarSettings, registry) - - err = DeployMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfContracts, linkFundsForEachUpkeep) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - - upkeeps := DeployKeeperConsumersPerformance( - t, chainClient, numberOfContracts, blockRange, blockInterval, checkGasToBurn, performGasToBurn, - ) - - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - - upkeepIds := RegisterUpkeepContracts(t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfContracts, upkeepsAddresses, false, false, false, nil) - - return registry, registrar, upkeeps, upkeepIds -} - -// DeployPerformDataCheckerContracts deploys a set amount of keeper perform data checker contracts registered to a single registry -func DeployPerformDataCheckerContracts( - t *testing.T, - chainClient *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - numberOfContracts int, - upkeepGasLimit uint32, - linkToken contracts.LinkToken, - registrySettings *contracts.KeeperRegistrySettings, - linkFundsForEachUpkeep *big.Int, - expectedData []byte, -) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperPerformDataChecker, []*big.Int) { - ef, err := contracts.DeployMockLINKETHFeed(chainClient, big.NewInt(2e18)) - require.NoError(t, err, "Deploying mock ETH-Link feed shouldn't fail") - gf, err := contracts.DeployMockGASFeed(chainClient, big.NewInt(2e11)) - require.NoError(t, err, "Deploying mock gas feed shouldn't fail") - - registry, err := contracts.DeployKeeperRegistry( - chainClient, - &contracts.KeeperRegistryOpts{ - RegistryVersion: registryVersion, - LinkAddr: linkToken.Address(), - ETHFeedAddr: ef.Address(), - GasFeedAddr: gf.Address(), - TranscoderAddr: ZeroAddress.Hex(), - RegistrarAddr: ZeroAddress.Hex(), - Settings: *registrySettings, - }, - ) - require.NoError(t, err, "Deploying KeeperRegistry shouldn't fail") - - // Fund the registry with 1 LINK * amount of KeeperConsumerPerformance contracts - err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(numberOfContracts)))) - require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - - registrarSettings := contracts.KeeperRegistrarSettings{ - AutoApproveConfigType: 2, - AutoApproveMaxAllowed: math.MaxUint16, - RegistryAddr: registry.Address(), - MinLinkJuels: big.NewInt(0), - } - - registrar := DeployKeeperRegistrar(t, chainClient, registryVersion, linkToken, registrarSettings, registry) - upkeeps := DeployPerformDataChecker(t, chainClient, numberOfContracts, expectedData) - - err = DeployMultiCallAndFundDeploymentAddresses(chainClient, linkToken, numberOfContracts, linkFundsForEachUpkeep) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - - var upkeepsAddresses []string - for _, upkeep := range upkeeps { - upkeepsAddresses = append(upkeepsAddresses, upkeep.Address()) - } - - upkeepIds := RegisterUpkeepContracts(t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfContracts, upkeepsAddresses, false, false, false, nil) - - return registry, registrar, upkeeps, upkeepIds -} - -func DeployKeeperRegistrar( - t *testing.T, - client *seth.Client, - registryVersion ethereum.KeeperRegistryVersion, - linkToken contracts.LinkToken, - registrarSettings contracts.KeeperRegistrarSettings, - registry contracts.KeeperRegistry, -) contracts.KeeperRegistrar { - registrar, err := contracts.DeployKeeperRegistrar(client, registryVersion, linkToken.Address(), registrarSettings) - require.NoError(t, err, "Failed waiting for registrar to deploy") - if registryVersion != ethereum.RegistryVersion_2_0 { - err = registry.SetRegistrar(registrar.Address()) - require.NoError(t, err, "Registering the registrar address on the registry shouldn't fail") - } - - return registrar -} - -func RegisterUpkeepContracts(t *testing.T, client *seth.Client, linkToken contracts.LinkToken, fundsForEachUpkeep *big.Int, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, isLogTrigger bool, isMercury bool, isBillingTokenNative bool, wethToken contracts.WETHToken) []*big.Int { - checkData := make([][]byte, 0) - for range numberOfContracts { - checkData = append(checkData, []byte("0")) - } - return RegisterUpkeepContractsWithCheckData( - t, client, linkToken, fundsForEachUpkeep, upkeepGasLimit, registry, registrar, - numberOfContracts, upkeepAddresses, checkData, isLogTrigger, isMercury, isBillingTokenNative, wethToken) -} - -type upkeepRegistrationResult struct { - upkeepID UpkeepId -} - -func (r upkeepRegistrationResult) GetResult() *big.Int { - return r.upkeepID -} - -type upkeepConfig struct { - address string - data []byte -} - -type UpkeepId = *big.Int - -func RegisterUpkeepContractsWithCheckData(t *testing.T, client *seth.Client, linkToken contracts.LinkToken, fundsForEachUpkeep *big.Int, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, checkData [][]byte, isLogTrigger bool, isMercury bool, isBillingTokenNative bool, wethToken contracts.WETHToken) []*big.Int { - l := logging.GetTestLogger(t) - - concurrency, err := GetAndAssertCorrectConcurrency(client, 1) - require.NoError(t, err, "Insufficient concurrency to execute action") - - executor := ctf_concurrency.NewConcurrentExecutor[UpkeepId, upkeepRegistrationResult, upkeepConfig](l) - - configs := make([]upkeepConfig, 0) - for i := range upkeepAddresses { - configs = append(configs, upkeepConfig{address: upkeepAddresses[i], data: checkData[i]}) - } - - var registerUpkeepFn = func(resultCh chan upkeepRegistrationResult, errorCh chan error, executorNum int, config upkeepConfig) { - id := uuid.New().String() - keyNum := executorNum + 1 // key 0 is the root key - var tx *types.Transaction - - if isBillingTokenNative { - // register upkeep with native token - tx, err = registrar.RegisterUpkeepFromKey( - keyNum, - "upkeep_"+id, - []byte("test@mail.com"), - config.address, - upkeepGasLimit, - client.MustGetRootKeyAddress().Hex(), // upkeep Admin - config.data, - fundsForEachUpkeep, - wethToken.Address(), - isLogTrigger, - isMercury, - ) - if err != nil { - errorCh <- errors.Wrapf(err, "[id: %s] Failed to register upkeep at %s", id, config.address) - return - } - } else { - // register upkeep with LINK - req, err := registrar.EncodeRegisterRequest( - "upkeep_"+id, - []byte("test@mail.com"), - config.address, - upkeepGasLimit, - client.MustGetRootKeyAddress().Hex(), // upkeep Admin - config.data, - fundsForEachUpkeep, - 0, - client.Addresses[keyNum].Hex(), - isLogTrigger, - isMercury, - linkToken.Address(), - ) - - if err != nil { - errorCh <- errors.Wrapf(err, "[id: %s] Failed to encode register request for upkeep at %s", id, config.address) - return - } - - balance, err := linkToken.BalanceOf(context.Background(), client.Addresses[keyNum].Hex()) - if err != nil { - errorCh <- errors.Wrapf(err, "[id: %s]Failed to get LINK balance of %s", id, client.Addresses[keyNum].Hex()) - return - } - - // not strictly necessary, but helps us to avoid an errorless revert if there is not enough LINK - if balance.Cmp(fundsForEachUpkeep) < 0 { - errorCh <- fmt.Errorf("[id: %s] Not enough LINK balance for %s. Has: %s. Needs: %s", id, client.Addresses[keyNum].Hex(), balance.String(), fundsForEachUpkeep.String()) - return - } - - tx, err = linkToken.TransferAndCallFromKey(registrar.Address(), fundsForEachUpkeep, req, keyNum) - if err != nil { - errorCh <- errors.Wrapf(err, "[id: %s] Failed to register upkeep at %s", id, config.address) - return - } - } - - // parse txn to get upkeep ID - receipt, err := client.Client.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - errorCh <- errors.Wrapf(err, "[id: %s] Failed to get receipt for upkeep at %s and tx hash %s", id, config.address, tx.Hash()) - return - } - - var upkeepId *big.Int - for _, rawLog := range receipt.Logs { - parsedUpkeepId, err := registry.ParseUpkeepIdFromRegisteredLog(rawLog) - if err == nil { - upkeepId = parsedUpkeepId - break - } - } - - if upkeepId == nil { - errorCh <- errors.Wrapf(err, "[id: %s] Failed find upkeep ID for upkeep at %s in logs of tx with hash %s", id, config.address, tx.Hash()) - return - } - - l.Debug(). - Str("TxHash", tx.Hash().String()). - Str("Upkeep ID", upkeepId.String()). - Msg("Found upkeepId in tx hash") - - resultCh <- upkeepRegistrationResult{upkeepID: upkeepId} - } - - upkeepIds, err := executor.Execute(concurrency, configs, registerUpkeepFn) - require.NoError(t, err, "Failed to register upkeeps using executor") - - require.Len(t, upkeepIds, numberOfContracts, "Incorrect number of Keeper Consumer Contracts registered") - l.Info().Msg("Successfully registered all Keeper Consumer Contracts") - - return upkeepIds -} - -type keeperConsumerResult struct { - contract contracts.KeeperConsumer -} - -func (k keeperConsumerResult) GetResult() contracts.KeeperConsumer { - return k.contract -} - -// DeployKeeperConsumers concurrently deploys keeper consumer contracts. It requires at least 1 ephemeral key to be present in Seth config. -func DeployKeeperConsumers(t *testing.T, client *seth.Client, numberOfContracts int, isLogTrigger bool, isMercury bool) []contracts.KeeperConsumer { - l := logging.GetTestLogger(t) - - concurrency, err := GetAndAssertCorrectConcurrency(client, 1) - require.NoError(t, err, "Insufficient concurrency to execute action") - - executor := ctf_concurrency.NewConcurrentExecutor[contracts.KeeperConsumer, keeperConsumerResult, ctf_concurrency.NoTaskType](l) - - var deployContractFn = func(channel chan keeperConsumerResult, errorCh chan error, executorNum int) { - keyNum := executorNum + 1 // key 0 is the root key - var keeperConsumerInstance contracts.KeeperConsumer - var err error - - if isMercury && isLogTrigger { - // v2.1 only: Log triggered based contract with Mercury enabled - keeperConsumerInstance, err = contracts.DeployAutomationLogTriggeredStreamsLookupUpkeepConsumerFromKey(client, keyNum) - } else if isMercury { - // v2.1 only: Conditional based contract with Mercury enabled - keeperConsumerInstance, err = contracts.DeployAutomationStreamsLookupUpkeepConsumerFromKey(client, keyNum, big.NewInt(1000), big.NewInt(5), false, true, false) // 1000 block test range - } else if isLogTrigger { - // v2.1+: Log triggered based contract without Mercury - keeperConsumerInstance, err = contracts.DeployAutomationLogTriggerConsumerFromKey(client, keyNum, big.NewInt(1000)) // 1000 block test range - } else { - // v2.0+: Conditional based contract without Mercury - keeperConsumerInstance, err = contracts.DeployUpkeepCounterFromKey(client, keyNum, big.NewInt(999999), big.NewInt(5)) - } - - if err != nil { - errorCh <- errors.Wrapf(err, "Failed to deploy keeper consumer contract") - return - } - - channel <- keeperConsumerResult{contract: keeperConsumerInstance} - } - - results, err := executor.ExecuteSimple(concurrency, numberOfContracts, deployContractFn) - require.NoError(t, err, "Failed to deploy keeper consumers") - - // require.Equal(t, 0, len(deplymentErrors), "Error deploying consumer contracts") - require.Len(t, results, numberOfContracts, "Incorrect number of Keeper Consumer Contracts deployed") - l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") - - return results -} - -// SetupKeeperConsumers concurrently loads or deploys keeper consumer contracts. It requires at least 1 ephemeral key to be present in Seth config. -func SetupKeeperConsumers(t *testing.T, client *seth.Client, numberOfContracts int, isLogTrigger bool, isMercury bool, config tt.AutomationTestConfig) []contracts.KeeperConsumer { - l := logging.GetTestLogger(t) - - var results []contracts.KeeperConsumer - - if config.GetAutomationConfig().UseExistingUpkeepContracts() { - contractsLoaded, err := config.GetAutomationConfig().UpkeepContractAddresses() - require.NoError(t, err, "Failed to get upkeep contract addresses") - require.Len(t, contractsLoaded, numberOfContracts, "Incorrect number of Keeper Consumer Contracts loaded") - l.Info().Int("Number of Contracts", numberOfContracts).Msg("Loading upkeep contracts from config") - // Load existing contracts - for i := range numberOfContracts { - require.NoError(t, err, "Failed to get upkeep contract addresses") - contract, err := contracts.LoadKeeperConsumer(client, contractsLoaded[i]) - require.NoError(t, err, "Failed to load keeper consumer contract") - l.Info().Str("Contract Address", contract.Address()).Int("Number", i+1).Int("Out Of", numberOfContracts).Msg("Loaded Keeper Consumer Contract") - results = append(results, contract) - } - } else { - // Deploy new contracts - return DeployKeeperConsumers(t, client, numberOfContracts, isLogTrigger, isMercury) - } - - return results -} - -// DeployKeeperConsumersPerformance sequentially deploys keeper performance consumer contracts. -func DeployKeeperConsumersPerformance( - t *testing.T, - client *seth.Client, - numberOfContracts int, - blockRange, // How many blocks to run the test for - blockInterval, // Interval of blocks that upkeeps are expected to be performed - checkGasToBurn, // How much gas should be burned on checkUpkeep() calls - performGasToBurn int64, // How much gas should be burned on performUpkeep() calls -) []contracts.KeeperConsumerPerformance { - l := logging.GetTestLogger(t) - upkeeps := make([]contracts.KeeperConsumerPerformance, 0) - - for contractCount := range numberOfContracts { - // Deploy consumer - keeperConsumerInstance, err := contracts.DeployKeeperConsumerPerformance( - client, - big.NewInt(blockRange), - big.NewInt(blockInterval), - big.NewInt(checkGasToBurn), - big.NewInt(performGasToBurn), - ) - require.NoError(t, err, "Deploying KeeperConsumerPerformance instance %d shouldn't fail", contractCount+1) - upkeeps = append(upkeeps, keeperConsumerInstance) - l.Debug(). - Str("Contract Address", keeperConsumerInstance.Address()). - Int("Number", contractCount+1). - Int("Out Of", numberOfContracts). - Msg("Deployed Keeper Performance Contract") - } - - require.Len(t, upkeeps, numberOfContracts, "Incorrect number of consumers contracts deployed") - l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") - - return upkeeps -} - -// DeployPerformDataChecker sequentially deploys keeper perform data checker contracts. -func DeployPerformDataChecker( - t *testing.T, - client *seth.Client, - numberOfContracts int, - expectedData []byte, -) []contracts.KeeperPerformDataChecker { - l := logging.GetTestLogger(t) - upkeeps := make([]contracts.KeeperPerformDataChecker, 0) - - for contractCount := range numberOfContracts { - performDataCheckerInstance, err := contracts.DeployKeeperPerformDataChecker(client, expectedData) - require.NoError(t, err, "Deploying KeeperPerformDataChecker instance %d shouldn't fail", contractCount+1) - upkeeps = append(upkeeps, performDataCheckerInstance) - l.Debug(). - Str("Contract Address", performDataCheckerInstance.Address()). - Int("Number", contractCount+1). - Int("Out Of", numberOfContracts). - Msg("Deployed PerformDataChecker Contract") - } - require.Len(t, upkeeps, numberOfContracts, "Incorrect number of PerformDataChecker contracts deployed") - l.Info().Msg("Successfully deployed all PerformDataChecker Contracts") - - return upkeeps -} - -// DeployUpkeepCounters sequentially deploys a set amount of upkeep counter contracts. -func DeployUpkeepCounters( - t *testing.T, - client *seth.Client, - numberOfContracts int, - testRange *big.Int, - interval *big.Int, -) []contracts.UpkeepCounter { - l := logging.GetTestLogger(t) - upkeepCounters := make([]contracts.UpkeepCounter, 0) - - for contractCount := range numberOfContracts { - // Deploy consumer - upkeepCounter, err := contracts.DeployUpkeepCounter(client, testRange, interval) - require.NoError(t, err, "Deploying KeeperConsumer instance %d shouldn't fail", contractCount+1) - upkeepCounters = append(upkeepCounters, upkeepCounter) - l.Debug(). - Str("Contract Address", upkeepCounter.Address()). - Int("Number", contractCount+1). - Int("Out Of", numberOfContracts). - Msg("Deployed Keeper Consumer Contract") - } - require.Len(t, upkeepCounters, numberOfContracts, "Incorrect number of Keeper Consumer contracts deployed") - l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") - - return upkeepCounters -} - -// DeployUpkeepPerformCounter sequentially deploys a set amount of upkeep perform counter restrictive contracts. -func DeployUpkeepPerformCounterRestrictive( - t *testing.T, - client *seth.Client, - numberOfContracts int, - testRange *big.Int, - averageEligibilityCadence *big.Int, -) []contracts.UpkeepPerformCounterRestrictive { - l := logging.GetTestLogger(t) - upkeepCounters := make([]contracts.UpkeepPerformCounterRestrictive, 0) - - for contractCount := range numberOfContracts { - // Deploy consumer - upkeepCounter, err := contracts.DeployUpkeepPerformCounterRestrictive(client, testRange, averageEligibilityCadence) - require.NoError(t, err, "Deploying KeeperConsumer instance %d shouldn't fail", contractCount+1) - upkeepCounters = append(upkeepCounters, upkeepCounter) - l.Debug(). - Str("Contract Address", upkeepCounter.Address()). - Int("Number", contractCount+1). - Int("Out Of", numberOfContracts). - Msg("Deployed Keeper Consumer Contract") - } - require.Len(t, upkeepCounters, numberOfContracts, "Incorrect number of Keeper Consumer contracts deployed") - l.Info().Msg("Successfully deployed all Keeper Consumer Contracts") - - return upkeepCounters -} - -// RegisterNewUpkeeps concurrently 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 RegisterNewUpkeeps( - t *testing.T, - chainClient *seth.Client, - linkToken contracts.LinkToken, - registry contracts.KeeperRegistry, - registrar contracts.KeeperRegistrar, - upkeepGasLimit uint32, - numberOfNewUpkeeps int, -) ([]contracts.KeeperConsumer, []*big.Int) { - newlyDeployedUpkeeps := DeployKeeperConsumers(t, chainClient, numberOfNewUpkeeps, false, false) - - var addressesOfNewUpkeeps []string - for _, upkeep := range newlyDeployedUpkeeps { - addressesOfNewUpkeeps = append(addressesOfNewUpkeeps, upkeep.Address()) - } - - concurrency, err := GetAndAssertCorrectConcurrency(chainClient, 1) - require.NoError(t, err, "Insufficient concurrency to execute action") - - operationsPerAddress := numberOfNewUpkeeps / concurrency - - multicallAddress, err := contracts.DeployMultiCallContract(chainClient) - require.NoError(t, err, "Error deploying multicall contract") - - linkFundsForEachUpkeep := big.NewInt(9e18) - - err = SendLinkFundsToDeploymentAddresses(chainClient, concurrency, numberOfNewUpkeeps, operationsPerAddress, multicallAddress, linkFundsForEachUpkeep, linkToken) - require.NoError(t, err, "Sending link funds to deployment addresses shouldn't fail") - - newUpkeepIDs := RegisterUpkeepContracts(t, chainClient, linkToken, linkFundsForEachUpkeep, upkeepGasLimit, registry, registrar, numberOfNewUpkeeps, addressesOfNewUpkeeps, false, false, false, nil) - - return newlyDeployedUpkeeps, newUpkeepIDs -} - -var INSUFFICIENT_EPHEMERAL_KEYS = ` -Error: Insufficient Ephemeral Addresses for Simulated Network - -To operate on a simulated network, you must configure at least one ephemeral address. Currently, %d ephemeral address(es) are set. Please update your TOML configuration file as follows to meet this requirement: -[Seth] ephemeral_addresses_number = 1 - -This adjustment ensures that your setup is minimaly viable. Although it is highly recommended to use at least 20 ephemeral addresses. -` - -var INSUFFICIENT_STATIC_KEYS = ` -Error: Insufficient Private Keys for Live Network - -To run this test on a live network, you must either: -1. Set at least two private keys in the '[Network.WalletKeys]' section of your TOML configuration file. Example format: - [Network.WalletKeys] - NETWORK_NAME=["PRIVATE_KEY_1", "PRIVATE_KEY_2"] -2. Set at least two private keys in the '[Network.EVMNetworks.NETWORK_NAME] section of your TOML configuration file. Example format: - evm_keys=["PRIVATE_KEY_1", "PRIVATE_KEY_2"] - -Currently, only %d private key/s is/are set. - -Recommended Action: -Distribute your funds across multiple private keys and update your configuration accordingly. Even though 1 private key is sufficient for testing, it is highly recommended to use at least 10 private keys. -` - -// GetAndAssertCorrectConcurrency checks Seth configuration for the number of ephemeral keys or static keys (depending on Seth configuration) and makes sure that -// the number is at least minConcurrency. If the number is less than minConcurrency, it returns an error. The root key is always excluded from the count. -func GetAndAssertCorrectConcurrency(client *seth.Client, minConcurrency int) (int, error) { - concurrency := client.Cfg.GetMaxConcurrency() - - if concurrency < minConcurrency { - var err error - if client.Cfg.IsSimulatedNetwork() { - err = fmt.Errorf(INSUFFICIENT_EPHEMERAL_KEYS, concurrency) - } else { - err = fmt.Errorf(INSUFFICIENT_STATIC_KEYS, concurrency) - } - return 0, err - } - - return concurrency, nil -} diff --git a/integration-tests/actions/keeper_helpers_local.go b/integration-tests/actions/keeper_helpers_local.go deleted file mode 100644 index 194a8cb77ea..00000000000 --- a/integration-tests/actions/keeper_helpers_local.go +++ /dev/null @@ -1,60 +0,0 @@ -package actions - -import ( - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -func CreateKeeperJobsLocal( - l zerolog.Logger, - chainlinkNodes []*nodeclient.ChainlinkClient, - keeperRegistry contracts.KeeperRegistry, - ocrConfig contracts.OCRv2Config, - evmChainID string, -) ([]*nodeclient.Job, error) { - // Send keeper jobs to registry and chainlink nodes - primaryNode := chainlinkNodes[0] - primaryNodeAddress, err := primaryNode.PrimaryEthAddress() - if err != nil { - l.Error().Err(err).Msg("Reading ETH Keys from Chainlink Client shouldn't fail") - return nil, err - } - nodeAddresses, err := ChainlinkNodeAddressesLocal(chainlinkNodes) - if err != nil { - l.Error().Err(err).Msg("Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") - return nil, err - } - nodeAddressesStr, payees := make([]string, 0), make([]string, 0) - for _, cla := range nodeAddresses { - nodeAddressesStr = append(nodeAddressesStr, cla.Hex()) - payees = append(payees, primaryNodeAddress) - } - err = keeperRegistry.SetKeepers(nodeAddressesStr, payees, ocrConfig) - if err != nil { - l.Error().Err(err).Msg("Setting keepers in the registry shouldn't fail") - return nil, err - } - jobs := []*nodeclient.Job{} - for _, chainlinkNode := range chainlinkNodes { - chainlinkNodeAddress, err := chainlinkNode.PrimaryEthAddress() - if err != nil { - l.Error().Err(err).Msg("Error retrieving chainlink node address") - return nil, err - } - job, err := chainlinkNode.MustCreateJob(&nodeclient.KeeperJobSpec{ - Name: "keeper-test-" + keeperRegistry.Address(), - ContractAddress: keeperRegistry.Address(), - FromAddress: chainlinkNodeAddress, - EVMChainID: evmChainID, - MinIncomingConfirmations: 1, - }) - if err != nil { - l.Error().Err(err).Msg("Creating KeeperV2 Job shouldn't fail") - return nil, err - } - jobs = append(jobs, job) - } - return jobs, nil -} diff --git a/integration-tests/actions/ocr2_helpers.go b/integration-tests/actions/ocr2_helpers.go deleted file mode 100644 index 261f1d84c4d..00000000000 --- a/integration-tests/actions/ocr2_helpers.go +++ /dev/null @@ -1,396 +0,0 @@ -package actions - -import ( - "crypto/ed25519" - "encoding/hex" - "errors" - "fmt" - "net/http" - "strings" - "time" - - "github.com/avast/retry-go" - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - "github.com/lib/pq" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - "golang.org/x/sync/errgroup" - "gopkg.in/guregu/null.v4" - - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/keystore/corekeys" - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - ctfClient "github.com/smartcontractkit/chainlink-testing-framework/lib/client" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" -) - -// BuildMedianOCR2Config builds a default OCRv2 config for the given chainlink nodes for a standard median aggregation job -func BuildMedianOCR2Config( - workerNodes []*nodeclient.ChainlinkK8sClient, - ocrOffchainOptions contracts.OffchainOptions, -) (*contracts.OCRv2Config, error) { - S, oracleIdentities, err := GetOracleIdentities(workerNodes) - if err != nil { - return nil, err - } - signerKeys, transmitterAccounts, f_, _, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( - 30*time.Second, // deltaProgress time.Duration, - 30*time.Second, // deltaResend time.Duration, - 10*time.Second, // deltaRound time.Duration, - 20*time.Second, // deltaGrace time.Duration, - 20*time.Second, // deltaStage time.Duration, - 3, // rMax uint8, - S, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - median.OffchainConfig{ - AlphaReportInfinite: false, - AlphaReportPPB: 1, - AlphaAcceptInfinite: false, - AlphaAcceptPPB: 1, - DeltaC: time.Minute * 30, - }.Encode(), // reportingPluginConfig []byte, - nil, - 5*time.Second, // maxDurationQuery time.Duration, - 5*time.Second, // maxDurationObservation time.Duration, - 5*time.Second, // maxDurationReport time.Duration, - 5*time.Second, // maxDurationShouldAcceptFinalizedReport time.Duration, - 5*time.Second, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - nil, // The median reporting plugin has an empty onchain config - ) - if err != nil { - return nil, err - } - - // Convert signers to addresses - var signerAddresses []common.Address - for _, signer := range signerKeys { - signerAddresses = append(signerAddresses, common.BytesToAddress(signer)) - } - - // Convert transmitters to addresses - var transmitterAddresses []common.Address - for _, account := range transmitterAccounts { - transmitterAddresses = append(transmitterAddresses, common.HexToAddress(string(account))) - } - - onchainConfig, err := testhelpers.GenerateDefaultOCR2OnchainConfig(ocrOffchainOptions.MinimumAnswer, ocrOffchainOptions.MaximumAnswer) - - return &contracts.OCRv2Config{ - Signers: signerAddresses, - Transmitters: transmitterAddresses, - F: f_, - OnchainConfig: onchainConfig, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: fmt.Appendf(nil, "0x%s", offchainConfig), - }, err -} - -// GetOracleIdentities retrieves all chainlink nodes' OCR2 config identities with defaul key index -func GetOracleIdentities(chainlinkNodes []*nodeclient.ChainlinkK8sClient) ([]int, []confighelper.OracleIdentityExtra, error) { - return GetOracleIdentitiesWithKeyIndex(chainlinkNodes, 0) -} - -// GetOracleIdentitiesWithKeyIndex retrieves all chainlink nodes' OCR2 config identities by key index -func GetOracleIdentitiesWithKeyIndex( - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - keyIndex int, -) ([]int, []confighelper.OracleIdentityExtra, error) { - S := make([]int, len(chainlinkNodes)) - oracleIdentities := make([]confighelper.OracleIdentityExtra, len(chainlinkNodes)) - sharedSecretEncryptionPublicKeys := make([]types.ConfigEncryptionPublicKey, len(chainlinkNodes)) - eg := &errgroup.Group{} - for i, cl := range chainlinkNodes { - index, chainlinkNode := i, cl - eg.Go(func() error { - addresses, err := chainlinkNode.EthAddresses() - if err != nil { - return err - } - ocr2Keys, err := chainlinkNode.MustReadOCR2Keys() - if err != nil { - return err - } - var ocr2Config nodeclient.OCR2KeyAttributes - for _, key := range ocr2Keys.Data { - if key.Attributes.ChainType == string(corekeys.EVM) { - ocr2Config = key.Attributes - break - } - } - - keys, err := chainlinkNode.MustReadP2PKeys() - if err != nil { - return err - } - p2pKeyID := keys.Data[0].Attributes.PeerID - - offchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.OffChainPublicKey, "ocr2off_evm_")) - if err != nil { - return err - } - - offchainPkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(offchainPkBytesFixed[:], offchainPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - configPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.ConfigPublicKey, "ocr2cfg_evm_")) - if err != nil { - return err - } - - configPkBytesFixed := [ed25519.PublicKeySize]byte{} - n = copy(configPkBytesFixed[:], configPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - onchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.OnChainPublicKey, "ocr2on_evm_")) - if err != nil { - return err - } - - sharedSecretEncryptionPublicKeys[index] = configPkBytesFixed - oracleIdentities[index] = confighelper.OracleIdentityExtra{ - OracleIdentity: confighelper.OracleIdentity{ - OnchainPublicKey: onchainPkBytes, - OffchainPublicKey: offchainPkBytesFixed, - PeerID: p2pKeyID, - TransmitAccount: types.Account(addresses[keyIndex]), - }, - ConfigEncryptionPublicKey: configPkBytesFixed, - } - S[index] = 1 - log.Debug(). - Interface("OnChainPK", onchainPkBytes). - Interface("OffChainPK", offchainPkBytesFixed). - Interface("ConfigPK", configPkBytesFixed). - Str("PeerID", p2pKeyID). - Str("Address", addresses[keyIndex]). - Msg("Oracle identity") - return nil - }) - } - - return S, oracleIdentities, eg.Wait() -} - -// 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 CreateOCRv2Jobs( - ocrInstances []contracts.OffchainAggregatorV2, - bootstrapNode *nodeclient.ChainlinkK8sClient, - workerChainlinkNodes []*nodeclient.ChainlinkK8sClient, - mockserver *ctfClient.MockserverClient, - mockServerValue int, // Value to get from the mock server when querying the path - chainId int64, // EVM chain ID - forwardingAllowed bool, - l zerolog.Logger, -) error { - // Collect P2P ID - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - return err - } - p2pV2Bootstrapper := fmt.Sprintf("%s@%s:%d", bootstrapP2PIds.Data[0].Attributes.PeerID, bootstrapNode.InternalIP(), 6690) - mockJuelsPath := "ocr2/juelsPerFeeCoinSource" - // Set the juelsPerFeeCoinSource config value - err = mockserver.SetValuePath(mockJuelsPath, mockServerValue) - if err != nil { - return err - } - - // Create the juels bridge for each node only once - juelsBridge := &nodeclient.BridgeTypeAttributes{ - Name: "juels", - URL: fmt.Sprintf("%s/%s", mockserver.Config.ClusterURL, mockJuelsPath), - } - for _, chainlinkNode := range workerChainlinkNodes { - err = chainlinkNode.MustCreateBridge(juelsBridge) - if err != nil { - return fmt.Errorf("failed creating bridge %s on CL node : %w", juelsBridge.Name, err) - } - } - - // Initialize map to store job IDs for each chainlink node - jobIDs := make(map[*nodeclient.ChainlinkK8sClient][]string) - - for _, ocrInstance := range ocrInstances { - bootstrapSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2-bootstrap-" + ocrInstance.Address(), - JobType: "bootstrap", - OCR2OracleSpec: job.OCR2OracleSpec{ - ContractID: ocrInstance.Address(), - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": chainId, - }, - MonitoringEndpoint: null.StringFrom(fmt.Sprintf("%s/%s", mockserver.Config.ClusterURL, "ocr2")), - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(15 * time.Second), - }, - } - _, err := bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - return fmt.Errorf("creating bootstrap job have failed: %w", err) - } - - for _, chainlinkNode := range workerChainlinkNodes { - nodeTransmitterAddress, err := chainlinkNode.PrimaryEthAddress() - if err != nil { - return fmt.Errorf("getting primary ETH address from OCR node have failed: %w", err) - } - nodeOCRKeys, err := chainlinkNode.MustReadOCR2Keys() - if err != nil { - return fmt.Errorf("getting OCR keys from OCR node have failed: %w", err) - } - nodeOCRKeyId := nodeOCRKeys.Data[0].ID - - nodeContractPairID, err := BuildOCR2NodeContractPairID(chainlinkNode, ocrInstance) - if err != nil { - return err - } - bta := &nodeclient.BridgeTypeAttributes{ - Name: nodeContractPairID, - URL: fmt.Sprintf("%s/%s", mockserver.Config.ClusterURL, strings.TrimPrefix(nodeContractPairID, "/")), - } - - err = chainlinkNode.MustCreateBridge(bta) - if err != nil { - return fmt.Errorf("failed creating bridge %s on CL node: %w", bta.Name, err) - } - - ocrSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2-" + uuid.NewString(), - JobType: "offchainreporting2", - MaxTaskDuration: "1m", - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - ForwardingAllowed: forwardingAllowed, - OCR2OracleSpec: job.OCR2OracleSpec{ - PluginType: "median", - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": chainId, - }, - PluginConfig: map[string]any{ - "juelsPerFeeCoinSource": fmt.Sprintf("\"\"\"%s\"\"\"", nodeclient.ObservationSourceSpecBridge(juelsBridge)), - }, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(15 * time.Second), - ContractID: ocrInstance.Address(), // registryAddr - OCRKeyBundleID: null.StringFrom(nodeOCRKeyId), // get node ocr2config.ID - TransmitterID: null.StringFrom(nodeTransmitterAddress), // node addr - P2PV2Bootstrappers: pq.StringArray{p2pV2Bootstrapper}, // bootstrap node key and address @bootstrap:6690 - }, - } - var ocrJob *nodeclient.Job - ocrJob, err = chainlinkNode.MustCreateJob(ocrSpec) - if err != nil { - return fmt.Errorf("creating OCR task job on OCR node have failed: %w", err) - } - jobIDs[chainlinkNode] = append(jobIDs[chainlinkNode], ocrJob.Data.ID) // Store each job ID per node - } - } - l.Info().Msg("Verify OCRv2 jobs have been created") - for chainlinkNode, ids := range jobIDs { - for _, jobID := range ids { - err := retry.Do( - func() error { - _, resp, err := chainlinkNode.ReadJob(jobID) - if err != nil { - return err - } - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("unexpected response status: %d", resp.StatusCode) - } - l.Info(). - Str("Node", chainlinkNode.PodName). - Str("Job ID", jobID). - Msg("OCRv2 job successfully created") - return nil - }, - retry.Attempts(4), - retry.Delay(time.Second*2), - retry.OnRetry(func(n uint, err error) { - l.Debug(). - Str("Node", chainlinkNode.PodName). - Str("Job ID", jobID). - Uint("Attempt", n+1). - Err(err). - Msg("Retrying job verification") - }), - ) - if err != nil { - l.Error().Err(err).Str("Node", chainlinkNode.PodName).Str("JobID", jobID).Msg("Failed to verify OCRv2 job creation") - } - } - } - return nil -} - -// SetOCR2AdapterResponse sets a single adapter response that correlates with an ocr contract and a chainlink node -// used for OCR2 tests -func SetOCR2AdapterResponse( - response int, - ocrInstance contracts.OffchainAggregatorV2, - chainlinkNode *nodeclient.ChainlinkK8sClient, - mockserver *ctfClient.MockserverClient, -) error { - nodeContractPairID, err := BuildOCR2NodeContractPairID(chainlinkNode, ocrInstance) - if err != nil { - return err - } - path := "/" + nodeContractPairID - err = mockserver.SetValuePath(path, response) - if err != nil { - return fmt.Errorf("setting mockserver value path failed: %w", err) - } - return nil -} - -// 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 SetOCR2AllAdapterResponsesToTheSameValue( - response int, - ocrInstances []contracts.OffchainAggregatorV2, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - mockserver *ctfClient.MockserverClient, -) error { - eg := &errgroup.Group{} - for _, o := range ocrInstances { - ocrInstance := o - for _, n := range chainlinkNodes { - node := n - eg.Go(func() error { - return SetOCR2AdapterResponse(response, ocrInstance, node, mockserver) - }) - } - } - return eg.Wait() -} - -// BuildOCR2NodeContractPairID builds a UUID based on a related pair of a Chainlink node and OCRv2 contract -func BuildOCR2NodeContractPairID(node *nodeclient.ChainlinkK8sClient, ocrInstance contracts.OffchainAggregatorV2) (string, error) { - if node == nil { - return "", errors.New("chainlink node is nil") - } - if ocrInstance == nil { - return "", errors.New("OCR Instance is nil") - } - nodeAddress, err := node.PrimaryEthAddress() - if err != nil { - return "", fmt.Errorf("getting chainlink node's primary ETH address failed: %w", err) - } - shortNodeAddr := nodeAddress[2:12] - shortOCRAddr := ocrInstance.Address()[2:12] - return strings.ToLower(fmt.Sprintf("node_%s_contract_%s", shortNodeAddr, shortOCRAddr)), nil -} diff --git a/integration-tests/actions/ocr2_helpers_local.go b/integration-tests/actions/ocr2_helpers_local.go deleted file mode 100644 index 1ba8b751ca6..00000000000 --- a/integration-tests/actions/ocr2_helpers_local.go +++ /dev/null @@ -1,375 +0,0 @@ -package actions - -import ( - "crypto/ed25519" - "encoding/hex" - "errors" - "fmt" - "net/http" - "path/filepath" - "strings" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - "github.com/lib/pq" - "github.com/rs/zerolog/log" - "golang.org/x/sync/errgroup" - "gopkg.in/guregu/null.v4" - - "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - - "github.com/smartcontractkit/chainlink-common/keystore/corekeys" - "github.com/smartcontractkit/chainlink-common/pkg/codec" - "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" - "github.com/smartcontractkit/chainlink-evm/pkg/config" - "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" - "github.com/smartcontractkit/chainlink-testing-framework/parrot" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" -) - -func CreateOCRv2JobsLocal( - ocrInstances []contracts.OffchainAggregatorV2, - bootstrapNode *nodeclient.ChainlinkClient, - workerChainlinkNodes []*nodeclient.ChainlinkClient, - mockAdapter *test_env.Parrot, - valueRoute *parrot.Route, - chainId uint64, // EVM chain ID - forwardingAllowed bool, - enableChainReaderAndCodec bool, -) error { - // Collect P2P ID - valPath := strings.TrimPrefix(valueRoute.Path, "/") - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - return err - } - p2pV2Bootstrapper := fmt.Sprintf("%s@%s:%d", bootstrapP2PIds.Data[0].Attributes.PeerID, bootstrapNode.InternalIP(), 6690) - // Set the value for the jobs to report on - err = mockAdapter.SetAdapterRoute(valueRoute) - if err != nil { - return err - } - // Set the juelsPerFeeCoinSource config value - juelsRoute := &parrot.Route{ - Method: parrot.MethodAny, - Path: filepath.Join(valPath, "juelsPerFeeCoinSource"), - ResponseBody: valueRoute.ResponseBody, - ResponseStatusCode: http.StatusOK, - } - err = mockAdapter.SetAdapterRoute(juelsRoute) - if err != nil { - return err - } - - for _, ocrInstance := range ocrInstances { - bootstrapSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2_bootstrap-" + uuid.NewString(), - JobType: "bootstrap", - OCR2OracleSpec: job.OCR2OracleSpec{ - ContractID: ocrInstance.Address(), - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": chainId, - }, - MonitoringEndpoint: null.StringFrom(fmt.Sprintf("%s/%s", mockAdapter.InternalEndpoint, valPath)), - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(15 * time.Second), - }, - } - _, err := bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - return fmt.Errorf("creating bootstrap job have failed: %w", err) - } - - for _, chainlinkNode := range workerChainlinkNodes { - nodeTransmitterAddress, err := chainlinkNode.PrimaryEthAddress() - if err != nil { - return fmt.Errorf("getting primary ETH address from OCR node have failed: %w", err) - } - nodeOCRKeys, err := chainlinkNode.MustReadOCR2Keys() - if err != nil { - return fmt.Errorf("getting OCR keys from OCR node have failed: %w", err) - } - nodeOCRKeyID := nodeOCRKeys.Data[0].ID - - bta := &nodeclient.BridgeTypeAttributes{ - Name: fmt.Sprintf("%s-%s", valPath, uuid.NewString()), - URL: fmt.Sprintf("%s/%s", mockAdapter.InternalEndpoint, valPath), - } - juelsBridge := &nodeclient.BridgeTypeAttributes{ - Name: "juels-" + uuid.NewString(), - URL: fmt.Sprintf("%s/%s", mockAdapter.InternalEndpoint, juelsRoute.Path), - } - err = chainlinkNode.MustCreateBridge(bta) - if err != nil { - return fmt.Errorf("creating bridge to %s on CL node failed: %w", bta.URL, err) - } - err = chainlinkNode.MustCreateBridge(juelsBridge) - if err != nil { - return fmt.Errorf("creating bridge to %s CL node failed: %w", juelsBridge.URL, err) - } - - ocrSpec := &nodeclient.OCR2TaskJobSpec{ - Name: "ocr2-" + uuid.NewString(), - JobType: "offchainreporting2", - MaxTaskDuration: "1m", - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - ForwardingAllowed: forwardingAllowed, - OCR2OracleSpec: job.OCR2OracleSpec{ - PluginType: "median", - Relay: "evm", - RelayConfig: map[string]any{ - "chainID": chainId, - }, - PluginConfig: map[string]any{ - "juelsPerFeeCoinSource": fmt.Sprintf("\"\"\"%s\"\"\"", nodeclient.ObservationSourceSpecBridge(juelsBridge)), - }, - ContractConfigTrackerPollInterval: *sqlutil.NewInterval(15 * time.Second), - ContractID: ocrInstance.Address(), // registryAddr - OCRKeyBundleID: null.StringFrom(nodeOCRKeyID), // get node ocr2config.ID - TransmitterID: null.StringFrom(nodeTransmitterAddress), // node addr - P2PV2Bootstrappers: pq.StringArray{p2pV2Bootstrapper}, // bootstrap node key and address @bootstrap:6690 - }, - } - if enableChainReaderAndCodec { - ocrSpec.OCR2OracleSpec.RelayConfig["chainReader"] = config.ChainReaderConfig{ - Contracts: map[string]config.ChainContractReader{ - "median": { - ContractPollingFilter: config.ContractPollingFilter{ - GenericEventNames: []string{"LatestRoundRequested"}, - }, - ContractABI: `[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"},{"indexed":false,"internalType":"uint8","name":"round","type":"uint8"}],"name":"RoundRequested","type":"event"},{"inputs":[],"name":"latestTransmissionDetails","outputs":[{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"},{"internalType":"uint8","name":"round","type":"uint8"},{"internalType":"int192","name":"latestAnswer_","type":"int192"},{"internalType":"uint64","name":"latestTimestamp_","type":"uint64"}],"stateMutability":"view","type":"function"}]`, - Configs: map[string]*config.ChainReaderDefinition{ - "LatestTransmissionDetails": { - ChainSpecificName: "latestTransmissionDetails", - OutputModifications: codec.ModifiersConfig{ - &codec.EpochToTimeModifierConfig{ - Fields: []string{"LatestTimestamp_"}, - }, - &codec.RenameModifierConfig{ - Fields: map[string]string{ - "LatestAnswer_": "LatestAnswer", - "LatestTimestamp_": "LatestTimestamp", - }, - }, - }, - }, - "LatestRoundRequested": { - ChainSpecificName: "RoundRequested", - ReadType: config.Event, - }, - }, - }, - }, - } - ocrSpec.OCR2OracleSpec.RelayConfig["codec"] = config.CodecConfig{ - Configs: map[string]config.ChainCodecConfig{ - "MedianReport": { - TypeABI: `[{"Name": "Timestamp","Type": "uint32"},{"Name": "Observers","Type": "bytes32"},{"Name": "Observations","Type": "int192[]"},{"Name": "JuelsPerFeeCoin","Type": "int192"}]`, - }, - }, - } - } - - _, err = chainlinkNode.MustCreateJob(ocrSpec) - if err != nil { - return fmt.Errorf("creating OCR task job on OCR node have failed: %w", err) - } - } - } - return nil -} - -func BuildMedianOCR2ConfigLocal(workerNodes []*nodeclient.ChainlinkClient, ocrOffchainOptions contracts.OffchainOptions) (*contracts.OCRv2Config, error) { - S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndexLocal(workerNodes, 0) - if err != nil { - return nil, err - } - signerKeys, transmitterAccounts, f_, _, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests( - 30*time.Second, // deltaProgress time.Duration, - 30*time.Second, // deltaResend time.Duration, - 10*time.Second, // deltaRound time.Duration, - 20*time.Second, // deltaGrace time.Duration, - 20*time.Second, // deltaStage time.Duration, - 3, // rMax uint8, - S, // s []int, - oracleIdentities, // oracles []OracleIdentityExtra, - median.OffchainConfig{ - AlphaReportInfinite: false, - AlphaReportPPB: 1, - AlphaAcceptInfinite: false, - AlphaAcceptPPB: 1, - DeltaC: time.Minute * 30, - }.Encode(), // reportingPluginConfig []byte, - nil, - 5*time.Second, // maxDurationQuery time.Duration, - 5*time.Second, // maxDurationObservation time.Duration, - 5*time.Second, // maxDurationReport time.Duration, - 5*time.Second, // maxDurationShouldAcceptFinalizedReport time.Duration, - 5*time.Second, // maxDurationShouldTransmitAcceptedReport time.Duration, - 1, // f int, - nil, // The median reporting plugin has an empty onchain config - ) - if err != nil { - return nil, err - } - - // Convert signers to addresses - var signerAddresses []common.Address - for _, signer := range signerKeys { - signerAddresses = append(signerAddresses, common.BytesToAddress(signer)) - } - - // Convert transmitters to addresses - var transmitterAddresses []common.Address - for _, account := range transmitterAccounts { - transmitterAddresses = append(transmitterAddresses, common.HexToAddress(string(account))) - } - - onchainConfig, err := testhelpers.GenerateDefaultOCR2OnchainConfig(ocrOffchainOptions.MinimumAnswer, ocrOffchainOptions.MaximumAnswer) - - return &contracts.OCRv2Config{ - Signers: signerAddresses, - Transmitters: transmitterAddresses, - F: f_, - OnchainConfig: onchainConfig, - OffchainConfigVersion: offchainConfigVersion, - OffchainConfig: fmt.Appendf(nil, "0x%s", offchainConfig), - }, err -} - -func GetOracleIdentitiesWithKeyIndexLocal( - chainlinkNodes []*nodeclient.ChainlinkClient, - keyIndex int, -) ([]int, []confighelper.OracleIdentityExtra, error) { - S := make([]int, len(chainlinkNodes)) - oracleIdentities := make([]confighelper.OracleIdentityExtra, len(chainlinkNodes)) - sharedSecretEncryptionPublicKeys := make([]types.ConfigEncryptionPublicKey, len(chainlinkNodes)) - eg := &errgroup.Group{} - for i, cl := range chainlinkNodes { - index, chainlinkNode := i, cl - eg.Go(func() error { - addresses, err := chainlinkNode.EthAddresses() - if err != nil { - return err - } - ocr2Keys, err := chainlinkNode.MustReadOCR2Keys() - if err != nil { - return err - } - var ocr2Config nodeclient.OCR2KeyAttributes - for _, key := range ocr2Keys.Data { - if key.Attributes.ChainType == string(corekeys.EVM) { - ocr2Config = key.Attributes - break - } - } - - keys, err := chainlinkNode.MustReadP2PKeys() - if err != nil { - return err - } - p2pKeyID := keys.Data[0].Attributes.PeerID - - offchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.OffChainPublicKey, "ocr2off_evm_")) - if err != nil { - return err - } - - offchainPkBytesFixed := [ed25519.PublicKeySize]byte{} - n := copy(offchainPkBytesFixed[:], offchainPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - configPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.ConfigPublicKey, "ocr2cfg_evm_")) - if err != nil { - return err - } - - configPkBytesFixed := [ed25519.PublicKeySize]byte{} - n = copy(configPkBytesFixed[:], configPkBytes) - if n != ed25519.PublicKeySize { - return errors.New("wrong number of elements copied") - } - - onchainPkBytes, err := hex.DecodeString(strings.TrimPrefix(ocr2Config.OnChainPublicKey, "ocr2on_evm_")) - if err != nil { - return err - } - - sharedSecretEncryptionPublicKeys[index] = configPkBytesFixed - oracleIdentities[index] = confighelper.OracleIdentityExtra{ - OracleIdentity: confighelper.OracleIdentity{ - OnchainPublicKey: onchainPkBytes, - OffchainPublicKey: offchainPkBytesFixed, - PeerID: p2pKeyID, - TransmitAccount: types.Account(addresses[keyIndex]), - }, - ConfigEncryptionPublicKey: configPkBytesFixed, - } - S[index] = 1 - log.Debug(). - Interface("OnChainPK", onchainPkBytes). - Interface("OffChainPK", offchainPkBytesFixed). - Interface("ConfigPK", configPkBytesFixed). - Str("PeerID", p2pKeyID). - Str("Address", addresses[keyIndex]). - Msg("Oracle identity") - return nil - }) - } - - return S, oracleIdentities, eg.Wait() -} - -// DeleteJobs will delete ALL jobs from the nodes -func DeleteJobs(nodes []*nodeclient.ChainlinkClient) error { - for _, node := range nodes { - if node == nil { - return fmt.Errorf("found a nil chainlink node in the list of chainlink nodes while tearing down: %v", nodes) - } - jobs, _, err := node.ReadJobs() - if err != nil { - return fmt.Errorf("error reading jobs from chainlink node: %w", err) - } - for _, maps := range jobs.Data { - if _, ok := maps["id"]; !ok { - return fmt.Errorf("error reading job id from chainlink node's jobs %+v", jobs.Data) - } - id := maps["id"].(string) - _, err2 := node.DeleteJob(id) - if err2 != nil { - return fmt.Errorf("error deleting job from chainlink node: %w", err) - } - } - } - return nil -} - -// DeleteBridges will delete ALL bridges from the nodes -func DeleteBridges(nodes []*nodeclient.ChainlinkClient) error { - for _, node := range nodes { - if node == nil { - return fmt.Errorf("found a nil chainlink node in the list of chainlink nodes while tearing down: %v", nodes) - } - - bridges, _, err := node.ReadBridges() - if err != nil { - return err - } - for _, b := range bridges.Data { - _, err = node.DeleteBridge(b.Attributes.Name) - if err != nil { - return err - } - } - } - return nil -} diff --git a/integration-tests/actions/ocr_helpers.go b/integration-tests/actions/ocr_helpers.go deleted file mode 100644 index 48e0794df43..00000000000 --- a/integration-tests/actions/ocr_helpers.go +++ /dev/null @@ -1,283 +0,0 @@ -package actions - -import ( - "errors" - "fmt" - "math/big" - "math/rand" - "strconv" - "strings" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - "github.com/rs/zerolog" - "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" - - ctfClient "github.com/smartcontractkit/chainlink-testing-framework/lib/client" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ocr" -) - -// This actions file often returns functions, rather than just values. These are used as common test helpers, and are -// handy to have returning as functions so that Ginkgo can use them in an aesthetically pleasing way. - -// 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 CreateOCRJobs( - ocrInstances []contracts.OffchainAggregator, - bootstrapNode *nodeclient.ChainlinkK8sClient, - workerNodes []*nodeclient.ChainlinkK8sClient, - mockValue int, - mockserver *ctfClient.MockserverClient, - evmChainID string, -) error { - for _, ocrInstance := range ocrInstances { - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - return fmt.Errorf("reading P2P keys from bootstrap node have failed: %w", err) - } - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - bootstrapSpec := &nodeclient.OCRBootstrapJobSpec{ - Name: "bootstrap-" + uuid.New().String(), - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID, - P2PPeerID: bootstrapP2PId, - IsBootstrapPeer: true, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - return fmt.Errorf("creating bootstrap job have failed: %w", err) - } - - for _, node := range workerNodes { - nodeP2PIds, err := node.MustReadP2PKeys() - if err != nil { - return fmt.Errorf("reading P2P keys from OCR node have failed: %w", err) - } - nodeP2PId := nodeP2PIds.Data[0].Attributes.PeerID - nodeTransmitterAddress, err := node.PrimaryEthAddress() - if err != nil { - return fmt.Errorf("getting primary ETH address from OCR node have failed: %w", err) - } - nodeOCRKeys, err := node.MustReadOCRKeys() - if err != nil { - return fmt.Errorf("getting OCR keys from OCR node have failed: %w", err) - } - nodeOCRKeyID := nodeOCRKeys.Data[0].ID - - nodeContractPairID, err := BuildNodeContractPairID(node, ocrInstance) - if err != nil { - return err - } - bta := &nodeclient.BridgeTypeAttributes{ - Name: nodeContractPairID, - URL: fmt.Sprintf("%s/%s", mockserver.Config.ClusterURL, strings.TrimPrefix(nodeContractPairID, "/")), - } - err = SetAdapterResponse(mockValue, ocrInstance, node, mockserver) - if err != nil { - return fmt.Errorf("setting adapter response for OCR node failed: %w", err) - } - err = node.MustCreateBridge(bta) - if err != nil { - return fmt.Errorf("creating bridge to %s CL node failed: %w", bta.URL, err) - } - - bootstrapPeers := []*nodeclient.ChainlinkClient{bootstrapNode.ChainlinkClient} - ocrSpec := &nodeclient.OCRTaskJobSpec{ - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID, - P2PPeerID: nodeP2PId, - P2PBootstrapPeers: bootstrapPeers, - KeyBundleID: nodeOCRKeyID, - TransmitterAddress: nodeTransmitterAddress, - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - } - _, err = node.MustCreateJob(ocrSpec) - if err != nil { - return fmt.Errorf("creating OCR task job on OCR node have failed: %w", err) - } - } - } - return nil -} - -// 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 CreateOCRJobsWithForwarder( - t *testing.T, - ocrInstances []contracts.OffchainAggregator, - bootstrapNode *nodeclient.ChainlinkK8sClient, - workerNodes []*nodeclient.ChainlinkK8sClient, - mockValue int, - mockserver *ctfClient.MockserverClient, - evmChainID int64, -) { - for _, ocrInstance := range ocrInstances { - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - require.NoError(t, err, "Shouldn't fail reading P2P keys from bootstrap node") - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - bootstrapSpec := &nodeclient.OCRBootstrapJobSpec{ - Name: "bootstrap-" + uuid.New().String(), - ContractAddress: ocrInstance.Address(), - EVMChainID: strconv.FormatInt(evmChainID, 10), - P2PPeerID: bootstrapP2PId, - IsBootstrapPeer: true, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - require.NoError(t, err, "Shouldn't fail creating bootstrap job on bootstrap node") - - for nodeIndex, node := range workerNodes { - nodeP2PIds, err := node.MustReadP2PKeys() - require.NoError(t, err, "Shouldn't fail reading P2P keys from OCR node %d", nodeIndex+1) - nodeP2PId := nodeP2PIds.Data[0].Attributes.PeerID - nodeTransmitterAddress, err := node.PrimaryEthAddress() - require.NoError(t, err, "Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) - nodeOCRKeys, err := node.MustReadOCRKeys() - require.NoError(t, err, "Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) - nodeOCRKeyID := nodeOCRKeys.Data[0].ID - - nodeContractPairID, err := BuildNodeContractPairID(node, ocrInstance) - require.NoError(t, err, "Failed building node contract pair ID for mockserver") - bta := &nodeclient.BridgeTypeAttributes{ - Name: nodeContractPairID, - URL: fmt.Sprintf("%s/%s", mockserver.Config.ClusterURL, strings.TrimPrefix(nodeContractPairID, "/")), - } - err = SetAdapterResponse(mockValue, ocrInstance, node, mockserver) - require.NoError(t, err, "Failed setting adapter responses for node %d", nodeIndex+1) - err = node.MustCreateBridge(bta) - require.NoError(t, err, "Failed creating bridge on OCR node %d", nodeIndex+1) - - bootstrapPeers := []*nodeclient.ChainlinkClient{bootstrapNode.ChainlinkClient} - ocrSpec := &nodeclient.OCRTaskJobSpec{ - ContractAddress: ocrInstance.Address(), - EVMChainID: strconv.FormatInt(evmChainID, 10), - P2PPeerID: nodeP2PId, - P2PBootstrapPeers: bootstrapPeers, - KeyBundleID: nodeOCRKeyID, - TransmitterAddress: nodeTransmitterAddress, - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - ForwardingAllowed: true, - } - _, err = node.MustCreateJob(ocrSpec) - require.NoError(t, err, "Shouldn't fail creating OCR Task job on OCR node %d", nodeIndex+1) - } - } -} - -// SetAdapterResponse sets a single adapter response that correlates with an ocr contract and a chainlink node -func SetAdapterResponse( - response int, - ocrInstance contracts.OffchainAggregator, - chainlinkNode *nodeclient.ChainlinkK8sClient, - mockserver *ctfClient.MockserverClient, -) error { - nodeContractPairID, err := BuildNodeContractPairID(chainlinkNode, ocrInstance) - if err != nil { - return err - } - path := "/" + nodeContractPairID - err = mockserver.SetValuePath(path, response) - if err != nil { - return fmt.Errorf("setting mockserver value path failed: %w", err) - } - return nil -} - -// 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 SetAllAdapterResponsesToTheSameValue( - response int, - ocrInstances []contracts.OffchainAggregator, - chainlinkNodes []*nodeclient.ChainlinkK8sClient, - mockserver *ctfClient.MockserverClient, -) error { - eg := &errgroup.Group{} - for _, o := range ocrInstances { - ocrInstance := o - for _, n := range chainlinkNodes { - node := n - eg.Go(func() error { - return SetAdapterResponse(response, ocrInstance, node, mockserver) - }) - } - } - return eg.Wait() -} - -// BuildNodeContractPairID builds a UUID based on a related pair of a Chainlink node and OCR contract -func BuildNodeContractPairID(node contracts.ChainlinkNodeWithKeysAndAddress, ocrInstance contracts.OffchainAggregator) (string, error) { - if node == nil { - return "", errors.New("chainlink node is nil") - } - if ocrInstance == nil { - return "", errors.New("OCR Instance is nil") - } - nodeAddress, err := node.PrimaryEthAddress() - if err != nil { - return "", fmt.Errorf("getting chainlink node's primary ETH address failed: %w", err) - } - shortNodeAddr := nodeAddress[2:12] - shortOCRAddr := ocrInstance.Address()[2:12] - return strings.ToLower(fmt.Sprintf("node_%s_contract_%s", shortNodeAddr, shortOCRAddr)), nil -} - -func SetupOCRv1Cluster( - l zerolog.Logger, - seth *seth.Client, - configWithLinkToken tc.LinkTokenContractConfig, - workerNodes []*nodeclient.ChainlinkK8sClient, -) (common.Address, error) { - err := FundChainlinkNodesFromRootAddress(l, seth, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(workerNodes), big.NewFloat(3)) - if err != nil { - return common.Address{}, err - } - linkContract, err := LinkTokenContract(l, seth, configWithLinkToken) - if err != nil { - return common.Address{}, err - } - return common.HexToAddress(linkContract.Address()), nil -} - -func SetupOCRv1Feed( - l zerolog.Logger, - seth *seth.Client, - lta common.Address, - ocrContractsConfig ocr.OffChainAggregatorsConfig, - msClient *ctfClient.MockserverClient, - bootstrapNode *nodeclient.ChainlinkK8sClient, - workerNodes []*nodeclient.ChainlinkK8sClient, -) ([]contracts.OffchainAggregator, error) { - ocrInstances, err := SetupOCRv1Contracts(l, seth, ocrContractsConfig, lta, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(workerNodes)) - if err != nil { - return nil, err - } - err = CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, msClient, strconv.FormatInt(seth.ChainID, 10)) - if err != nil { - return nil, err - } - return ocrInstances, nil -} - -func SimulateOCRv1EAActivity( - l zerolog.Logger, - eaChangeInterval time.Duration, - ocrInstances []contracts.OffchainAggregator, - workerNodes []*nodeclient.ChainlinkK8sClient, - msClient *ctfClient.MockserverClient, -) { - go func() { - for { - time.Sleep(eaChangeInterval) - if err := SetAllAdapterResponsesToTheSameValue(rand.Intn(1000), ocrInstances, workerNodes, msClient); err != nil { - l.Error().Err(err).Msg("failed to update mockserver responses") - } - } - }() -} diff --git a/integration-tests/actions/ocr_helpers_local.go b/integration-tests/actions/ocr_helpers_local.go deleted file mode 100644 index 992a65e4417..00000000000 --- a/integration-tests/actions/ocr_helpers_local.go +++ /dev/null @@ -1,236 +0,0 @@ -package actions - -import ( - "fmt" - "math/big" - "net/http" - "strings" - - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - "golang.org/x/sync/errgroup" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" - "github.com/smartcontractkit/chainlink-testing-framework/parrot" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -/* - These methods should be cleaned merged after we decouple ChainlinkClient and ChainlinkK8sClient - Please, use them while refactoring other tests to local docker env -*/ - -func ChainlinkNodeAddressesLocal(nodes []*nodeclient.ChainlinkClient) ([]common.Address, error) { - addresses := make([]common.Address, 0) - for _, node := range nodes { - primaryAddress, err := node.PrimaryEthAddress() - if err != nil { - return nil, err - } - addresses = append(addresses, common.HexToAddress(primaryAddress)) - } - return addresses, nil -} - -func CreateOCRJobsLocal( - ocrInstances []contracts.OffchainAggregator, - bootstrapNode *nodeclient.ChainlinkClient, - workerNodes []*nodeclient.ChainlinkClient, - mockValue int, - mockAdapter *test_env.Parrot, - evmChainID *big.Int, -) error { - for _, ocrInstance := range ocrInstances { - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - return fmt.Errorf("reading P2P keys from bootstrap node have failed: %w", err) - } - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - bootstrapSpec := &nodeclient.OCRBootstrapJobSpec{ - Name: "bootstrap-" + uuid.New().String(), - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID.String(), - P2PPeerID: bootstrapP2PId, - IsBootstrapPeer: true, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - return fmt.Errorf("creating bootstrap job have failed: %w", err) - } - - for _, node := range workerNodes { - nodeP2PIds, err := node.MustReadP2PKeys() - if err != nil { - return fmt.Errorf("reading P2P keys from OCR node have failed: %w", err) - } - nodeP2PId := nodeP2PIds.Data[0].Attributes.PeerID - nodeTransmitterAddress, err := node.PrimaryEthAddress() - if err != nil { - return fmt.Errorf("getting primary ETH address from OCR node have failed: %w", err) - } - nodeOCRKeys, err := node.MustReadOCRKeys() - if err != nil { - return fmt.Errorf("getting OCR keys from OCR node have failed: %w", err) - } - nodeOCRKeyID := nodeOCRKeys.Data[0].ID - - nodeContractPairID, err := BuildNodeContractPairID(node, ocrInstance) - if err != nil { - return err - } - bta := &nodeclient.BridgeTypeAttributes{ - Name: nodeContractPairID, - URL: fmt.Sprintf("%s/%s", mockAdapter.InternalEndpoint, strings.TrimPrefix(nodeContractPairID, "/")), - } - err = SetAdapterResponseLocal(mockValue, ocrInstance, node, mockAdapter) - if err != nil { - return fmt.Errorf("setting adapter response for OCR node failed: %w", err) - } - err = node.MustCreateBridge(bta) - if err != nil { - return fmt.Errorf("creating bridge to %s CL node failed: %w", bta.URL, err) - } - - bootstrapPeers := []*nodeclient.ChainlinkClient{bootstrapNode} - ocrSpec := &nodeclient.OCRTaskJobSpec{ - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID.String(), - P2PPeerID: nodeP2PId, - P2PBootstrapPeers: bootstrapPeers, - KeyBundleID: nodeOCRKeyID, - TransmitterAddress: nodeTransmitterAddress, - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - } - _, err = node.MustCreateJob(ocrSpec) - if err != nil { - return fmt.Errorf("creating OCR job on OCR node failed: %w", err) - } - } - } - return nil -} - -// SetAdapterResponseLocal sets the response of the mock adapter for a given OCR instance and Chainlink node -func SetAdapterResponseLocal( - response int, - ocrInstance contracts.OffchainAggregator, - chainlinkNode *nodeclient.ChainlinkClient, - mockAdapter *test_env.Parrot, -) error { - nodeContractPairID, err := BuildNodeContractPairID(chainlinkNode, ocrInstance) - if err != nil { - return err - } - route := &parrot.Route{ - Method: parrot.MethodAny, - Path: "/" + nodeContractPairID, - ResponseBody: response, - ResponseStatusCode: http.StatusOK, - } - err = mockAdapter.SetAdapterRoute(route) - if err != nil { - return fmt.Errorf("setting mock adapter value path failed: %w", err) - } - return nil -} - -// SetAllAdapterResponsesToTheSameValueLocal sets the response of the mock adapter for all OCR instances and Chainlink nodes to the same value -func SetAllAdapterResponsesToTheSameValueLocal( - response int, - ocrInstances []contracts.OffchainAggregator, - chainlinkNodes []*nodeclient.ChainlinkClient, - mockAdapter *test_env.Parrot, -) error { - eg := &errgroup.Group{} - for _, o := range ocrInstances { - ocrInstance := o - for _, n := range chainlinkNodes { - node := n - eg.Go(func() error { - return SetAdapterResponseLocal(response, ocrInstance, node, mockAdapter) - }) - } - } - return eg.Wait() -} - -func CreateOCRJobsWithForwarderLocal( - ocrInstances []contracts.OffchainAggregator, - bootstrapNode *nodeclient.ChainlinkClient, - workerNodes []*nodeclient.ChainlinkClient, - mockValue int, - mockAdapter *test_env.Parrot, - evmChainID string, -) error { - for _, ocrInstance := range ocrInstances { - bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() - if err != nil { - return err - } - bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID - bootstrapSpec := &nodeclient.OCRBootstrapJobSpec{ - Name: "bootstrap-" + uuid.New().String(), - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID, - P2PPeerID: bootstrapP2PId, - IsBootstrapPeer: true, - } - _, err = bootstrapNode.MustCreateJob(bootstrapSpec) - if err != nil { - return err - } - - for _, node := range workerNodes { - nodeP2PIds, err := node.MustReadP2PKeys() - if err != nil { - return err - } - nodeP2PId := nodeP2PIds.Data[0].Attributes.PeerID - nodeTransmitterAddress, err := node.PrimaryEthAddress() - if err != nil { - return err - } - nodeOCRKeys, err := node.MustReadOCRKeys() - if err != nil { - return err - } - nodeOCRKeyID := nodeOCRKeys.Data[0].ID - - nodeContractPairID, err := BuildNodeContractPairID(node, ocrInstance) - if err != nil { - return err - } - bta := &nodeclient.BridgeTypeAttributes{ - Name: nodeContractPairID, - URL: fmt.Sprintf("%s/%s", mockAdapter.InternalEndpoint, strings.TrimPrefix(nodeContractPairID, "/")), - } - err = SetAdapterResponseLocal(mockValue, ocrInstance, node, mockAdapter) - if err != nil { - return err - } - err = node.MustCreateBridge(bta) - if err != nil { - return err - } - - bootstrapPeers := []*nodeclient.ChainlinkClient{bootstrapNode} - ocrSpec := &nodeclient.OCRTaskJobSpec{ - ContractAddress: ocrInstance.Address(), - EVMChainID: evmChainID, - P2PPeerID: nodeP2PId, - P2PBootstrapPeers: bootstrapPeers, - KeyBundleID: nodeOCRKeyID, - TransmitterAddress: nodeTransmitterAddress, - ObservationSource: nodeclient.ObservationSourceSpecBridge(bta), - ForwardingAllowed: true, - } - _, err = node.MustCreateJob(ocrSpec) - if err != nil { - return err - } - } - } - return nil -} diff --git a/integration-tests/actions/private_network.go b/integration-tests/actions/private_network.go deleted file mode 100644 index 40fe317ab3f..00000000000 --- a/integration-tests/actions/private_network.go +++ /dev/null @@ -1,29 +0,0 @@ -package actions - -import ( - "github.com/rs/zerolog" - - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - ctf_config_types "github.com/smartcontractkit/chainlink-testing-framework/lib/config/types" - ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" -) - -func EthereumNetworkConfigFromConfig(l zerolog.Logger, config ctf_config.GlobalTestConfig) (network ctf_test_env.EthereumNetwork, err error) { - if config.GetPrivateEthereumNetworkConfig() == nil { - l.Warn().Msg("No TOML private ethereum network config found, will use old geth") - ethBuilder := ctf_test_env.NewEthereumNetworkBuilder() - network, err = ethBuilder. - WithEthereumVersion(ctf_config_types.EthereumVersion_Eth1). - WithExecutionLayer(ctf_config_types.ExecutionLayer_Geth). - Build() - - return - } - - ethBuilder := ctf_test_env.NewEthereumNetworkBuilder() - network, err = ethBuilder. - WithExistingConfig(*config.GetPrivateEthereumNetworkConfig()). - Build() - - return -} diff --git a/integration-tests/actions/teardown.go b/integration-tests/actions/teardown.go new file mode 100644 index 00000000000..fe3d4d25912 --- /dev/null +++ b/integration-tests/actions/teardown.go @@ -0,0 +1,274 @@ +package actions + +import ( + "context" + "crypto/ecdsa" + "encoding/json" + "fmt" + "math/big" + "testing" + "time" + + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/pkg/errors" + "github.com/rs/zerolog" + "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" + "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment" + "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" + "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" + "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" + "github.com/smartcontractkit/chainlink-testing-framework/seth" + "go.uber.org/zap/zapcore" + + "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" + "github.com/smartcontractkit/chainlink/integration-tests/contracts" +) + +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 +} + +func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (common.Address, error) { + publicKey := privateKey.Public() + publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) + if !ok { + return common.Address{}, errors.New("error casting public key to ECDSA") + } + return crypto.PubkeyToAddress(*publicKeyECDSA), nil +} + +// SendFunds sends native funds from a private key to a target address. +func SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPayload) (*types.Receipt, error) { + fromAddress, err := PrivateKeyToAddress(payload.PrivateKey) + if err != nil { + return nil, err + } + + ctx, cancel := context.WithTimeout(context.Background(), client.Cfg.Network.TxnTimeout.Duration()) + nonce, err := client.Client.PendingNonceAt(ctx, fromAddress) + defer cancel() + if err != nil { + return nil, err + } + + gasLimit, err := client.EstimateGasLimitForFundTransfer(fromAddress, payload.ToAddress, payload.Amount) + if err != nil { + transferGasFee := client.Cfg.Network.TransferGasFee + if transferGasFee < 0 { + return nil, fmt.Errorf("negative transfer gas fee: %d", transferGasFee) + } + gasLimit = uint64(transferGasFee) + } + if payload.GasLimit != nil { + if *payload.GasLimit < 0 { + return nil, fmt.Errorf("negative gas limit: %d", *payload.GasLimit) + } + gasLimit = uint64(*payload.GasLimit) + } + + gasPrice := big.NewInt(0) + gasFeeCap := big.NewInt(0) + gasTipCap := big.NewInt(0) + if client.Cfg.Network.EIP1559DynamicFees { + if payload.GasFeeCap == nil || payload.GasTipCap == nil { + txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit)) + gasFeeCap = txOptions.GasFeeCap + gasTipCap = txOptions.GasTipCap + } + if payload.GasFeeCap != nil { + gasFeeCap = payload.GasFeeCap + } + if payload.GasTipCap != nil { + gasTipCap = payload.GasTipCap + } + } else if payload.GasPrice == nil { + txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit)) + gasPrice = txOptions.GasPrice + } else { + gasPrice = payload.GasPrice + } + + var rawTx types.TxData + if client.Cfg.Network.EIP1559DynamicFees { + rawTx = &types.DynamicFeeTx{ + Nonce: nonce, + To: &payload.ToAddress, + Value: payload.Amount, + Gas: gasLimit, + GasFeeCap: gasFeeCap, + GasTipCap: gasTipCap, + } + } else { + rawTx = &types.LegacyTx{ + Nonce: nonce, + To: &payload.ToAddress, + Value: payload.Amount, + Gas: gasLimit, + GasPrice: gasPrice, + } + } + + signedTx, err := types.SignNewTx(payload.PrivateKey, types.LatestSignerForChainID(big.NewInt(client.ChainID)), rawTx) + if err != nil { + return nil, errors.Wrap(err, "failed to sign tx") + } + + txTimeout := client.Cfg.Network.TxnTimeout.Duration() + if payload.TxTimeout != nil { + txTimeout = *payload.TxTimeout + } + + logger.Debug(). + Str("From", fromAddress.Hex()). + Str("To", payload.ToAddress.Hex()). + Str("Amount (wei/ether)", fmt.Sprintf("%s/%s", payload.Amount, conversions.WeiToEther(payload.Amount).Text('f', -1))). + Uint64("Nonce", nonce). + Uint64("Gas Limit", gasLimit). + Str("Gas Price", gasPrice.String()). + Str("Gas Fee Cap", gasFeeCap.String()). + Str("Gas Tip Cap", gasTipCap.String()). + Bool("Dynamic fees", client.Cfg.Network.EIP1559DynamicFees). + Msg("About to send funds") + + ctx, cancel = context.WithTimeout(ctx, txTimeout) + defer cancel() + if err := client.Client.SendTransaction(ctx, signedTx); err != nil { + return nil, errors.Wrap(err, "failed to send transaction") + } + + receipt, receiptErr := client.WaitMined(ctx, logger, client.Client, signedTx) + if receiptErr != nil { + return nil, errors.Wrap(receiptErr, "failed to wait for transaction to be mined") + } + if receipt.Status == 1 { + return receipt, nil + } + + tx, _, err := client.Client.TransactionByHash(ctx, signedTx.Hash()) + if err != nil { + return nil, errors.Wrap(err, "failed to get transaction by hash") + } + _, err = client.Decode(tx, receiptErr) + if err != nil { + return nil, err + } + return receipt, nil +} + +// ReturnFunds attempts to return all the funds from the chainlink nodes to the network's default address. +func ReturnFunds(lggr zerolog.Logger, chainlinkNodes []*nodeclient.ChainlinkK8sClient, blockchainClient blockchain.EVMClient) error { + if blockchainClient == nil { + return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") + } + lggr.Info().Msg("Attempting to return Chainlink node funds to default network wallets") + if blockchainClient.NetworkSimulated() { + lggr.Info().Str("Network Name", blockchainClient.GetNetworkName()). + Msg("Network is a simulated network. Skipping fund return.") + return nil + } + + for _, chainlinkNode := range chainlinkNodes { + fundedKeys, err := chainlinkNode.ExportEVMKeysForChain(blockchainClient.GetChainID().String()) + if err != nil { + return err + } + for _, key := range fundedKeys { + keyToDecrypt, err := json.Marshal(key) + if err != nil { + return err + } + decryptedKey, err := keystore.DecryptKey(keyToDecrypt, nodeclient.ChainlinkKeyPassword) + if err != nil { + return err + } + err = blockchainClient.ReturnFunds(decryptedKey.PrivateKey) + if err != nil { + lggr.Error().Err(err).Str("Address", fundedKeys[0].Address).Msg("Error returning funds from Chainlink node") + } + } + } + return blockchainClient.WaitForEvents() +} + +// TeardownSuite tears down networks/clients and environment and creates logs for failed tests. +func TeardownSuite( + t *testing.T, + chainClient *seth.Client, + env *environment.Environment, + chainlinkNodes []*nodeclient.ChainlinkK8sClient, + optionalTestReporter testreporters.TestReporter, + failingLogLevel zapcore.Level, + grafnaUrlProvider testreporters.GrafanaURLProvider, + evmClients ...blockchain.EVMClient, +) error { + l := logging.GetTestLogger(t) + if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel, grafnaUrlProvider); err != nil { + return fmt.Errorf("error dumping environment logs, leaving environment running for manual retrieval, err: %w", err) + } + err := DeleteAllJobs(chainlinkNodes) + if err != nil { + l.Warn().Msgf("Error deleting jobs %+v", err) + } + + if chainlinkNodes != nil && chainClient != nil { + if err := ReturnFundsFromNodes(l, chainClient, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(chainlinkNodes)); err != nil { + fmt.Println(environment.FAILED_FUND_RETURN) + l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). + Msg("Error attempting to return funds from chainlink nodes to network's default wallet. Environment is left running so you can try manually!") + } + } else { + l.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") + } + + for _, c := range evmClients { + if c != nil && chainlinkNodes != nil && len(chainlinkNodes) > 0 { + if err := ReturnFunds(l, chainlinkNodes, c); err != nil { + fmt.Println(environment.FAILED_FUND_RETURN) + l.Error().Err(err).Str("Namespace", env.Cfg.Namespace). + Msg("Error attempting to return funds from chainlink nodes to network's default wallet. Environment is left running so you can try manually!") + } + } else { + l.Info().Msg("Successfully returned funds from chainlink nodes to default network wallets") + } + if c != nil { + if err := c.Close(); err != nil { + return err + } + } + } + + return env.Shutdown() +} + +// DeleteAllJobs deletes all jobs from all chainlink nodes. +func DeleteAllJobs(chainlinkNodes []*nodeclient.ChainlinkK8sClient) error { + for _, node := range chainlinkNodes { + if node == nil { + return fmt.Errorf("found a nil chainlink node in the list of chainlink nodes while tearing down: %v", chainlinkNodes) + } + jobs, _, err := node.ReadJobs() + if err != nil { + return fmt.Errorf("error reading jobs from chainlink node, err: %w", err) + } + for _, maps := range jobs.Data { + if _, ok := maps["id"]; !ok { + return fmt.Errorf("error reading job id from chainlink node's jobs %+v", jobs.Data) + } + id := maps["id"].(string) + if _, err := node.DeleteJob(id); err != nil { + return fmt.Errorf("error deleting job from chainlink node, err: %w", err) + } + } + } + return nil +} diff --git a/integration-tests/actions/vrf/common/actions.go b/integration-tests/actions/vrf/common/actions.go deleted file mode 100644 index abd53196ec5..00000000000 --- a/integration-tests/actions/vrf/common/actions.go +++ /dev/null @@ -1,509 +0,0 @@ -package common - -import ( - "context" - "encoding/json" - "fmt" - "math/big" - "os" - "sync" - "testing" - "time" - - "github.com/smartcontractkit/chainlink/integration-tests/utils" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/go-resty/resty/v2" - "github.com/google/uuid" - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - vrf_common_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/common/vrf" -) - -func CreateFundAndGetSendingKeys( - l zerolog.Logger, - client *seth.Client, - node *VRFNode, - chainlinkNodeFunding float64, - numberOfTxKeysToCreate int, - chainID *big.Int, -) ([]string, []common.Address, error) { - newNativeTokenKeyAddresses, err := CreateAndFundSendingKeys(l, client, node, chainlinkNodeFunding, numberOfTxKeysToCreate, chainID) - if err != nil { - return nil, nil, err - } - nativeTokenPrimaryKeyAddress, err := node.CLNode.API.PrimaryEthAddress() - if err != nil { - return nil, nil, fmt.Errorf("%s, err %w", ErrNodePrimaryKey, err) - } - allNativeTokenKeyAddressStrings := append(newNativeTokenKeyAddresses, nativeTokenPrimaryKeyAddress) - allNativeTokenKeyAddresses := make([]common.Address, len(allNativeTokenKeyAddressStrings)) - for _, addressString := range allNativeTokenKeyAddressStrings { - allNativeTokenKeyAddresses = append(allNativeTokenKeyAddresses, common.HexToAddress(addressString)) - } - return allNativeTokenKeyAddressStrings, allNativeTokenKeyAddresses, nil -} - -func CreateAndFundSendingKeys( - l zerolog.Logger, - client *seth.Client, - node *VRFNode, - chainlinkNodeFunding float64, - numberOfNativeTokenAddressesToCreate int, - chainID *big.Int, -) ([]string, error) { - var newNativeTokenKeyAddresses []string - for range numberOfNativeTokenAddressesToCreate { - newTxKey, response, err := node.CLNode.API.CreateTxKey("evm", chainID.String()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrNodeNewTxKey, err) - } - if response.StatusCode != 200 { - return nil, fmt.Errorf("error creating transaction key - response code, err %d", response.StatusCode) - } - newNativeTokenKeyAddresses = append(newNativeTokenKeyAddresses, newTxKey.Data.Attributes.Address) - _, err = actions.SendFunds(l, client, actions.FundsToSendPayload{ - ToAddress: common.HexToAddress(newTxKey.Data.Attributes.Address), - Amount: conversions.EtherToWei(big.NewFloat(chainlinkNodeFunding)), - PrivateKey: client.PrivateKeys[0], - }) - if err != nil { - return nil, err - } - } - return newNativeTokenKeyAddresses, nil -} - -func SetupBHSNode( - sethClient *seth.Client, - config *vrf_common_config.General, - numberOfTxKeysToCreate int, - chainID *big.Int, - coordinatorAddress string, - BHSAddress string, - txKeyFunding float64, - l zerolog.Logger, - bhsNode *VRFNode, -) error { - bhsTXKeyAddressStrings, _, err := CreateFundAndGetSendingKeys( - l, - sethClient, - bhsNode, - txKeyFunding, - numberOfTxKeysToCreate, - chainID, - ) - if err != nil { - return err - } - bhsNode.TXKeyAddressStrings = bhsTXKeyAddressStrings - bhsSpec := nodeclient.BlockhashStoreJobSpec{ - ForwardingAllowed: false, - CoordinatorV2Address: coordinatorAddress, - CoordinatorV2PlusAddress: coordinatorAddress, - BlockhashStoreAddress: BHSAddress, - FromAddresses: bhsTXKeyAddressStrings, - EVMChainID: chainID.String(), - WaitBlocks: *config.BHSJobWaitBlocks, - LookbackBlocks: *config.BHSJobLookBackBlocks, - PollPeriod: config.BHSJobPollPeriod.Duration, - RunTimeout: config.BHSJobRunTimeout.Duration, - } - l.Info().Msg("Creating BHS Job") - bhsJob, err := CreateBHSJob( - bhsNode.CLNode.API, - bhsSpec, - ) - if err != nil { - return fmt.Errorf("%s, err %w", "", err) - } - bhsNode.Job = bhsJob - return nil -} - -func CreateBHSJob( - chainlinkNode *nodeclient.ChainlinkClient, - bhsJobSpecConfig nodeclient.BlockhashStoreJobSpec, -) (*nodeclient.Job, error) { - jobUUID := uuid.New() - spec := &nodeclient.BlockhashStoreJobSpec{ - Name: fmt.Sprintf("bhs-%s", jobUUID), - ForwardingAllowed: bhsJobSpecConfig.ForwardingAllowed, - CoordinatorV2Address: bhsJobSpecConfig.CoordinatorV2Address, - CoordinatorV2PlusAddress: bhsJobSpecConfig.CoordinatorV2PlusAddress, - BlockhashStoreAddress: bhsJobSpecConfig.BlockhashStoreAddress, - FromAddresses: bhsJobSpecConfig.FromAddresses, - EVMChainID: bhsJobSpecConfig.EVMChainID, - ExternalJobID: jobUUID.String(), - WaitBlocks: bhsJobSpecConfig.WaitBlocks, - LookbackBlocks: bhsJobSpecConfig.LookbackBlocks, - PollPeriod: bhsJobSpecConfig.PollPeriod, - RunTimeout: bhsJobSpecConfig.RunTimeout, - } - - job, err := chainlinkNode.MustCreateJob(spec) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrCreatingBHSJob, err) - } - return job, nil -} - -func SetupBHFNode( - sethClient *seth.Client, - config *vrf_common_config.General, - numberOfTxKeysToCreate int, - chainID *big.Int, - coordinatorAddress string, - BHSAddress string, - batchBHSAddress string, - txKeyFunding float64, - l zerolog.Logger, - bhfNode *VRFNode, -) error { - bhfTXKeyAddressStrings, _, err := CreateFundAndGetSendingKeys( - l, - sethClient, - bhfNode, - txKeyFunding, - numberOfTxKeysToCreate, - chainID, - ) - if err != nil { - return err - } - bhfNode.TXKeyAddressStrings = bhfTXKeyAddressStrings - bhfSpec := nodeclient.BlockHeaderFeederJobSpec{ - ForwardingAllowed: false, - CoordinatorV2Address: coordinatorAddress, - CoordinatorV2PlusAddress: coordinatorAddress, - BlockhashStoreAddress: BHSAddress, - BatchBlockhashStoreAddress: batchBHSAddress, - FromAddresses: bhfTXKeyAddressStrings, - EVMChainID: chainID.String(), - WaitBlocks: *config.BHFJobWaitBlocks, - LookbackBlocks: *config.BHFJobLookBackBlocks, - PollPeriod: config.BHFJobPollPeriod.Duration, - RunTimeout: config.BHFJobRunTimeout.Duration, - } - l.Info().Msg("Creating BHF Job") - bhfJob, err := CreateBHFJob( - bhfNode.CLNode.API, - bhfSpec, - ) - if err != nil { - return fmt.Errorf("%s, err %w", "", err) - } - bhfNode.Job = bhfJob - return nil -} - -func CreateBHFJob( - chainlinkNode *nodeclient.ChainlinkClient, - bhfJobSpecConfig nodeclient.BlockHeaderFeederJobSpec, -) (*nodeclient.Job, error) { - jobUUID := uuid.New() - spec := &nodeclient.BlockHeaderFeederJobSpec{ - Name: fmt.Sprintf("bhf-%s", jobUUID), - ForwardingAllowed: bhfJobSpecConfig.ForwardingAllowed, - CoordinatorV2Address: bhfJobSpecConfig.CoordinatorV2Address, - CoordinatorV2PlusAddress: bhfJobSpecConfig.CoordinatorV2PlusAddress, - BlockhashStoreAddress: bhfJobSpecConfig.BlockhashStoreAddress, - BatchBlockhashStoreAddress: bhfJobSpecConfig.BatchBlockhashStoreAddress, - FromAddresses: bhfJobSpecConfig.FromAddresses, - EVMChainID: bhfJobSpecConfig.EVMChainID, - ExternalJobID: jobUUID.String(), - WaitBlocks: bhfJobSpecConfig.WaitBlocks, - LookbackBlocks: bhfJobSpecConfig.LookbackBlocks, - PollPeriod: bhfJobSpecConfig.PollPeriod, - RunTimeout: bhfJobSpecConfig.RunTimeout, - } - - job, err := chainlinkNode.MustCreateJob(spec) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrCreatingBHSJob, err) - } - return job, nil -} - -func WaitForRequestCountEqualToFulfilmentCount( - ctx context.Context, - consumer VRFLoadTestConsumer, - timeout time.Duration, - wg *sync.WaitGroup, -) (*big.Int, *big.Int, error) { - metricsChannel := make(chan *contracts.VRFLoadTestMetrics) - metricsErrorChannel := make(chan error) - - testContext, testCancel := context.WithTimeout(ctx, timeout) - defer testCancel() - - ticker := time.NewTicker(time.Second * 1) - var metrics *contracts.VRFLoadTestMetrics - for { - select { - case <-testContext.Done(): - ticker.Stop() - wg.Done() - return metrics.RequestCount, metrics.FulfilmentCount, - fmt.Errorf("timeout waiting for rand request and fulfilments to be equal AFTER performance test was executed. Request Count: %d, Fulfilment Count: %d", - metrics.RequestCount.Uint64(), metrics.FulfilmentCount.Uint64()) - case <-ticker.C: - go retrieveLoadTestMetrics(ctx, consumer, metricsChannel, metricsErrorChannel) - case metrics = <-metricsChannel: - if metrics.RequestCount.Cmp(metrics.FulfilmentCount) == 0 { - ticker.Stop() - wg.Done() - return metrics.RequestCount, metrics.FulfilmentCount, nil - } - case err := <-metricsErrorChannel: - ticker.Stop() - wg.Done() - return nil, nil, err - } - } -} - -func retrieveLoadTestMetrics( - ctx context.Context, - consumer VRFLoadTestConsumer, - metricsChannel chan *contracts.VRFLoadTestMetrics, - metricsErrorChannel chan error, -) { - metrics, err := consumer.GetLoadTestMetrics(ctx) - if err != nil { - metricsErrorChannel <- err - } - metricsChannel <- metrics -} - -func CreateNodeTypeToNodeMap(cluster *test_env.ClCluster, nodesToCreate []VRFNodeType) (map[VRFNodeType]*VRFNode, error) { - var nodesMap = make(map[VRFNodeType]*VRFNode) - if len(cluster.Nodes) < len(nodesToCreate) { - return nil, fmt.Errorf("not enough nodes in the cluster (cluster size is %d nodes) to create %d nodes", len(cluster.Nodes), len(nodesToCreate)) - } - for i, nodeType := range nodesToCreate { - nodesMap[nodeType] = &VRFNode{ - CLNode: cluster.Nodes[i], - } - } - return nodesMap, nil -} - -func CreateVRFKeyOnVRFNode(vrfNode *VRFNode, l zerolog.Logger) (*nodeclient.VRFKey, string, error) { - l.Info().Str("Node URL", vrfNode.CLNode.API.URL()).Msg("Creating VRF Key on the Node") - vrfKey, err := vrfNode.CLNode.API.MustCreateVRFKey() - if err != nil { - return nil, "", fmt.Errorf("%s, err %w", ErrCreatingVRFKey, err) - } - pubKeyCompressed := vrfKey.Data.ID - l.Info(). - Str("Node URL", vrfNode.CLNode.API.URL()). - Str("Keyhash", vrfKey.Data.Attributes.Hash). - Str("VRF Compressed Key", vrfKey.Data.Attributes.Compressed). - Str("VRF Uncompressed Key", vrfKey.Data.Attributes.Uncompressed). - Msg("VRF Key created on the Node") - return vrfKey, pubKeyCompressed, nil -} - -func FundNodesIfNeeded(ctx context.Context, existingEnvConfig *vrf_common_config.ExistingEnvConfig, client *seth.Client, l zerolog.Logger) error { - if *existingEnvConfig.NodeSendingKeyFundingMin > 0 { - for _, sendingKey := range existingEnvConfig.NodeSendingKeys { - address := common.HexToAddress(sendingKey) - sendingKeyBalance, err := client.Client.BalanceAt(ctx, address, nil) - if err != nil { - return err - } - fundingAtLeast := conversions.EtherToWei(big.NewFloat(*existingEnvConfig.NodeSendingKeyFundingMin)) - fundingToSendWei := new(big.Int).Sub(fundingAtLeast, sendingKeyBalance) - log := l.Info(). - Str("Sending Key", sendingKey). - Str("Sending Key Current Balance", sendingKeyBalance.String()). - Str("Should have at least", fundingAtLeast.String()) - if fundingToSendWei.Cmp(big.NewInt(0)) == 1 { - log. - Str("Funding Amount in wei", fundingToSendWei.String()). - Str("Funding Amount in ETH", conversions.WeiToEther(fundingToSendWei).String()). - Msg("Funding Node's Sending Key") - _, err := actions.SendFunds(l, client, actions.FundsToSendPayload{ - ToAddress: common.HexToAddress(sendingKey), - Amount: fundingToSendWei, - PrivateKey: client.PrivateKeys[0], - }) - if err != nil { - return err - } - } else { - log. - Msg("Skipping Node's Sending Key funding as it has enough funds") - } - } - } - return nil -} - -func BuildNewCLEnvForVRF(l zerolog.Logger, t *testing.T, envConfig VRFEnvConfig, newEnvConfig NewEnvConfig, network ctf_test_env.EthereumNetwork) (*test_env.CLClusterTestEnv, *seth.Client, error) { - env, err := test_env.NewCLTestEnvBuilder(). - WithTestInstance(t). - WithTestConfig(&envConfig.TestConfig). - WithPrivateEthereumNetwork(network.EthereumNetworkConfig). - WithCLNodes(len(newEnvConfig.NodesToCreate)). - WithChainlinkNodeLogScanner(newEnvConfig.ChainlinkNodeLogScannerSettings). - WithCustomCleanup(envConfig.CleanupFn). - Build() - if err != nil { - return nil, nil, fmt.Errorf("%s, err: %w", "error creating test env", err) - } - - evmNetwork, err := env.GetFirstEvmNetwork() - if err != nil { - return nil, nil, fmt.Errorf("%s, err: %w", "error getting first evm network", err) - } - sethClient, err := utils.TestAwareSethClient(t, envConfig.TestConfig, evmNetwork) - if err != nil { - return nil, nil, fmt.Errorf("%s, err: %w", "error getting seth client", err) - } - - err = actions.FundChainlinkNodesFromRootAddress(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(*envConfig.TestConfig.Common.ChainlinkNodeFunding)) - if err != nil { - return nil, nil, fmt.Errorf("%s, err: %w", "failed to fund the nodes", err) - } - - t.Cleanup(func() { - // ignore error, we will see failures in the logs anyway - _ = actions.ReturnFundsFromNodes(l, sethClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs())) - }) - - return env, sethClient, nil -} - -func LoadExistingCLEnvForVRF( - t *testing.T, - envConfig VRFEnvConfig, - commonExistingEnvConfig *vrf_common_config.ExistingEnvConfig, - l zerolog.Logger, -) (*test_env.CLClusterTestEnv, *seth.Client, error) { - env, err := test_env.NewCLTestEnvBuilder(). - WithTestInstance(t). - WithTestConfig(&envConfig.TestConfig). - WithCustomCleanup(envConfig.CleanupFn). - Build() - if err != nil { - return nil, nil, fmt.Errorf("%s, err: %w", "error creating test env", err) - } - evmNetwork, err := env.GetFirstEvmNetwork() - if err != nil { - return nil, nil, err - } - sethClient, err := utils.TestAwareSethClient(t, envConfig.TestConfig, evmNetwork) - if err != nil { - return nil, nil, err - } - err = FundNodesIfNeeded(testcontext.Get(t), commonExistingEnvConfig, sethClient, l) - if err != nil { - return nil, nil, err - } - return env, sethClient, nil -} - -func GetRPCUrl(env *test_env.CLClusterTestEnv, chainID int64) (string, error) { - provider, err := env.GetRpcProvider(chainID) - if err != nil { - return "", err - } - return provider.PublicHttpUrls()[0], nil -} - -// 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" -type RPCRawClient struct { - resty *resty.Client -} - -func NewRPCRawClient(url string) *RPCRawClient { - isDebug := os.Getenv("RESTY_DEBUG") == "true" - restyClient := resty.New().SetDebug(isDebug).SetBaseURL(url) - return &RPCRawClient{ - resty: restyClient, - } -} - -func (g *RPCRawClient) SetHeadForSimulatedChain(setHeadToBlockNumber uint64) (JsonRPCResponse, error) { - var responseObject JsonRPCResponse - postBody, _ := json.Marshal(map[string]any{ - "jsonrpc": "2.0", - "id": 1, - "method": "debug_setHead", - "params": []string{hexutil.EncodeUint64(setHeadToBlockNumber)}, - }) - resp, err := g.resty.R(). - SetHeader("Content-Type", "application/json"). - SetBody(postBody). - SetResult(&responseObject). - Post("") - - if err != nil { - return JsonRPCResponse{}, fmt.Errorf("error making API request: %w", err) - } - statusCode := resp.StatusCode() - if statusCode != 200 && statusCode != 201 { - return JsonRPCResponse{}, fmt.Errorf("error invoking debug_setHead method, received unexpected status code %d: %s", statusCode, resp.String()) - } - if responseObject.Error != "" { - return JsonRPCResponse{}, fmt.Errorf("received non-empty error field: %v", responseObject.Error) - } - return responseObject, nil -} - -type JsonRPCResponse struct { - Version string `json:"jsonrpc"` - Id int `json:"id"` - Result string `json:"result,omitempty"` - Error string `json:"error,omitempty"` -} - -// todo - move to CTF -func RewindSimulatedChainToBlockNumber( - ctx context.Context, - client *seth.Client, - rpcURL string, - rewindChainToBlockNumber uint64, - l zerolog.Logger, -) (uint64, error) { - latestBlockNumberBeforeReorg, err := client.Client.BlockNumber(ctx) - if err != nil { - return 0, fmt.Errorf("error getting latest block number: %w", err) - } - - l.Info(). - Str("RPC URL", rpcURL). - Uint64("Latest Block Number before Reorg", latestBlockNumberBeforeReorg). - Uint64("Rewind Chain to Block Number", rewindChainToBlockNumber). - Msg("Performing Reorg on chain by rewinding chain to specific block number") - - _, err = NewRPCRawClient(rpcURL).SetHeadForSimulatedChain(rewindChainToBlockNumber) - - if err != nil { - return 0, fmt.Errorf("error making reorg: %w", err) - } - - latestBlockNumberAfterReorg, err := client.Client.BlockNumber(ctx) - if err != nil { - return 0, fmt.Errorf("error getting latest block number: %w", err) - } - - l.Info(). - Uint64("Block Number", latestBlockNumberAfterReorg). - Msg("Latest Block Number after Reorg") - return latestBlockNumberAfterReorg, nil -} diff --git a/integration-tests/actions/vrf/common/errors.go b/integration-tests/actions/vrf/common/errors.go deleted file mode 100644 index 78b7457e29f..00000000000 --- a/integration-tests/actions/vrf/common/errors.go +++ /dev/null @@ -1,31 +0,0 @@ -package common - -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" - - 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" - ErrFilterRandomWordsFulfilledEvent = "error filtering RandomWordsFulfilled event" -) diff --git a/integration-tests/actions/vrf/common/logging_helpers.go b/integration-tests/actions/vrf/common/logging_helpers.go deleted file mode 100644 index 23f6c0fffc0..00000000000 --- a/integration-tests/actions/vrf/common/logging_helpers.go +++ /dev/null @@ -1,133 +0,0 @@ -package common - -import ( - "fmt" - "math/big" - - "github.com/rs/zerolog" - - commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_owner" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" - "github.com/smartcontractkit/chainlink-evm/pkg/assets" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -func LogSubDetails( - l zerolog.Logger, - subscription contracts.Subscription, - subID string, - coordinator contracts.Coordinator, -) { - log := l.Info(). - Str("Coordinator", coordinator.Address()). - Str("Link Balance", (*commonassets.Link)(subscription.Balance).Link()). - Str("Subscription ID", subID). - Str("Subscription Owner", subscription.SubOwner.String()). - Interface("Subscription Consumers", subscription.Consumers) - if subscription.NativeBalance != nil { - log = log.Str("Native Token Balance", assets.FormatWei(subscription.NativeBalance)) - } - log.Msg("Subscription Data") -} - -func LogRandomnessRequestedEvent( - l zerolog.Logger, - coordinator contracts.Coordinator, - randomWordsRequestedEvent *contracts.CoordinatorRandomWordsRequested, - isNativeBilling bool, - keyNum int, -) { - l.Info(). - Int("KeyNum", keyNum). - Str("Coordinator", coordinator.Address()). - Bool("Native Billing", isNativeBilling). - Str("Request ID", randomWordsRequestedEvent.RequestId.String()). - Str("Subscription ID", randomWordsRequestedEvent.SubId). - Str("Sender Address", randomWordsRequestedEvent.Sender.String()). - Str("Keyhash", fmt.Sprintf("0x%x", randomWordsRequestedEvent.KeyHash)). - Uint32("Callback Gas Limit", randomWordsRequestedEvent.CallbackGasLimit). - Uint32("Number of Words", randomWordsRequestedEvent.NumWords). - Uint16("Minimum Request Confirmations", randomWordsRequestedEvent.MinimumRequestConfirmations). - Str("TX Hash", randomWordsRequestedEvent.Raw.TxHash.String()). - Uint64("BlockNumber", randomWordsRequestedEvent.Raw.BlockNumber). - Str("BlockHash", randomWordsRequestedEvent.Raw.BlockHash.String()). - Msg("RandomnessRequested Event") -} - -func LogRandomWordsFulfilledEvent( - l zerolog.Logger, - coordinator contracts.Coordinator, - randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled, - isNativeBilling bool, - keyNum int, -) { - l.Info(). - Int("KeyNum", keyNum). - Bool("Native Billing", isNativeBilling). - Str("Coordinator", coordinator.Address()). - Str("Total Payment", randomWordsFulfilledEvent.Payment.String()). - Str("TX Hash", randomWordsFulfilledEvent.Raw.TxHash.String()). - Str("Subscription ID", randomWordsFulfilledEvent.SubId). - Str("Request ID", randomWordsFulfilledEvent.RequestId.String()). - Bool("Success", randomWordsFulfilledEvent.Success). - Uint64("BlockNumber", randomWordsFulfilledEvent.Raw.BlockNumber). - Str("BlockHash", randomWordsFulfilledEvent.Raw.BlockHash.String()). - Msg("RandomWordsFulfilled Event (TX metadata)") -} - -func LogFulfillmentDetailsLinkBilling( - l zerolog.Logger, - wrapperConsumerJuelsBalanceBeforeRequest *big.Int, - wrapperConsumerJuelsBalanceAfterRequest *big.Int, - consumerStatus vrfv2plus_wrapper_load_test_consumer.GetRequestStatus, - randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled, -) { - l.Info(). - Str("Consumer Balance Before Request (Link)", (*commonassets.Link)(wrapperConsumerJuelsBalanceBeforeRequest).Link()). - Str("Consumer Balance After Request (Link)", (*commonassets.Link)(wrapperConsumerJuelsBalanceAfterRequest).Link()). - Bool("Fulfilment Status", consumerStatus.Fulfilled). - Str("Paid by Consumer Contract (Link)", (*commonassets.Link)(consumerStatus.Paid).Link()). - Str("Paid by Coordinator Sub (Link)", (*commonassets.Link)(randomWordsFulfilledEvent.Payment).Link()). - Str("RequestTimestamp", consumerStatus.RequestTimestamp.String()). - Str("FulfilmentTimestamp", consumerStatus.FulfilmentTimestamp.String()). - Str("RequestBlockNumber", consumerStatus.RequestBlockNumber.String()). - Str("FulfilmentBlockNumber", consumerStatus.FulfilmentBlockNumber.String()). - Str("TX Hash", randomWordsFulfilledEvent.Raw.TxHash.String()). - Msg("Random Words Fulfilment Details For Link Billing") -} - -func LogFulfillmentDetailsNativeBilling( - l zerolog.Logger, - wrapperConsumerBalanceBeforeRequestWei *big.Int, - wrapperConsumerBalanceAfterRequestWei *big.Int, - consumerStatus vrfv2plus_wrapper_load_test_consumer.GetRequestStatus, - randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled, -) { - l.Info(). - Str("Consumer Balance Before Request", assets.FormatWei(wrapperConsumerBalanceBeforeRequestWei)). - Str("Consumer Balance After Request", assets.FormatWei(wrapperConsumerBalanceAfterRequestWei)). - Bool("Fulfilment Status", consumerStatus.Fulfilled). - Str("Paid by Consumer Contract", assets.FormatWei(consumerStatus.Paid)). - Str("Paid by Coordinator Sub", assets.FormatWei(randomWordsFulfilledEvent.Payment)). - Str("RequestTimestamp", consumerStatus.RequestTimestamp.String()). - Str("FulfilmentTimestamp", consumerStatus.FulfilmentTimestamp.String()). - Str("RequestBlockNumber", consumerStatus.RequestBlockNumber.String()). - Str("FulfilmentBlockNumber", consumerStatus.FulfilmentBlockNumber.String()). - Str("TX Hash", randomWordsFulfilledEvent.Raw.TxHash.String()). - Msg("Random Words Request Fulfilment Details For Native Billing") -} - -func LogRandomWordsForcedEvent( - l zerolog.Logger, - vrfOwner contracts.VRFOwner, - randomWordsForcedEvent *vrf_owner.VRFOwnerRandomWordsForced, -) { - l.Debug(). - Str("VRFOwner", vrfOwner.Address()). - Uint64("Sub ID", randomWordsForcedEvent.SubId). - Str("TX Hash", randomWordsForcedEvent.Raw.TxHash.String()). - Str("Request ID", randomWordsForcedEvent.RequestId.String()). - Str("Sender", randomWordsForcedEvent.Sender.String()). - Msg("RandomWordsForced Event (TX metadata)") -} diff --git a/integration-tests/actions/vrf/common/models.go b/integration-tests/actions/vrf/common/models.go deleted file mode 100644 index 24b73c3ae52..00000000000 --- a/integration-tests/actions/vrf/common/models.go +++ /dev/null @@ -1,99 +0,0 @@ -package common - -import ( - "context" - "math/big" - "time" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -type VRFEncodedProvingKey [2]*big.Int - -// VRFV2PlusKeyData defines a jobs into and proving key info -type VRFKeyData struct { - VRFKey *nodeclient.VRFKey - EncodedProvingKey VRFEncodedProvingKey - KeyHash [32]byte - PubKeyCompressed string -} - -type VRFNodeType int - -const ( - VRF VRFNodeType = iota + 1 - BHS - BHF -) - -func (n VRFNodeType) String() string { - return [...]string{"VRF", "BHS", "BHF"}[n-1] -} - -func (n VRFNodeType) Index() int { - return int(n) -} - -type VRFNode struct { - CLNode *test_env.ClNode - Job *nodeclient.Job - TXKeyAddressStrings []string -} - -type VRFContracts struct { - CoordinatorV2 contracts.VRFCoordinatorV2 - BatchCoordinatorV2 contracts.BatchVRFCoordinatorV2 - CoordinatorV2Plus contracts.VRFCoordinatorV2_5 - BatchCoordinatorV2Plus contracts.BatchVRFCoordinatorV2Plus - VRFOwner contracts.VRFOwner - BHS contracts.BlockHashStore - BatchBHS contracts.BatchBlockhashStore - VRFV2Consumers []contracts.VRFv2LoadTestConsumer - VRFV2PlusConsumer []contracts.VRFv2PlusLoadTestConsumer - LinkToken contracts.LinkToken - MockETHLINKFeed contracts.VRFMockETHLINKFeed - LinkNativeFeedAddress string -} - -type VRFOwnerConfig struct { - OwnerAddress string - UseVRFOwner bool -} - -type VRFJobSpecConfig struct { - ForwardingAllowed bool - CoordinatorAddress string - BatchCoordinatorAddress 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 VRFLoadTestConsumer interface { - GetLoadTestMetrics(ctx context.Context) (*contracts.VRFLoadTestMetrics, error) -} - -type NewEnvConfig struct { - NodesToCreate []VRFNodeType - NumberOfTxKeysToCreate int - UseVRFOwner bool - UseTestCoordinator bool - ChainlinkNodeLogScannerSettings test_env.ChainlinkNodeLogScannerSettings -} - -type VRFEnvConfig struct { - TestConfig tc.TestConfig - ChainID int64 - CleanupFn func() -} diff --git a/integration-tests/actions/vrf/vrfv1/actions.go b/integration-tests/actions/vrf/vrfv1/actions.go deleted file mode 100644 index f5fae76a395..00000000000 --- a/integration-tests/actions/vrf/vrfv1/actions.go +++ /dev/null @@ -1,37 +0,0 @@ -package vrfv1 - -import ( - "fmt" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -var ( - ErrDeployBHSV1 = "error deploying BlockHashStoreV1 contract" - ErrDeployVRFCootrinatorV1 = "error deploying VRFv1 Coordinator contract" - ErrDeployVRFConsumerV1 = "error deploying VRFv1 Consumer contract" -) - -type Contracts struct { - BHS contracts.BlockHashStore - Coordinator contracts.VRFCoordinator - Consumer contracts.VRFConsumer -} - -func DeployVRFContracts(client *seth.Client, linkTokenAddress string) (*Contracts, error) { - bhs, err := contracts.DeployBlockhashStore(client) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployBHSV1, err) - } - coordinator, err := contracts.DeployVRFCoordinator(client, linkTokenAddress, bhs.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployVRFCootrinatorV1, err) - } - consumer, err := contracts.DeployVRFConsumer(client, linkTokenAddress, coordinator.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployVRFConsumerV1, err) - } - return &Contracts{bhs, coordinator, consumer}, nil -} diff --git a/integration-tests/actions/vrf/vrfv2/contract_steps.go b/integration-tests/actions/vrf/vrfv2/contract_steps.go deleted file mode 100644 index 70aba689c5a..00000000000 --- a/integration-tests/actions/vrf/vrfv2/contract_steps.go +++ /dev/null @@ -1,678 +0,0 @@ -package vrfv2 - -import ( - "context" - "errors" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog" - "github.com/shopspring/decimal" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - vrfcommon "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/common" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - testconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_owner" - "github.com/smartcontractkit/chainlink-evm/pkg/utils" -) - -func DeployVRFV2Contracts( - sethClient *seth.Client, - linkTokenContract contracts.LinkToken, - linkEthFeedContract contracts.VRFMockETHLINKFeed, - useVRFOwner bool, - useTestCoordinator bool, -) (*vrfcommon.VRFContracts, error) { - bhs, err := contracts.DeployBlockhashStore(sethClient) - if err != nil { - return nil, fmt.Errorf("%s, err %w", vrfcommon.ErrDeployBlockHashStore, err) - } - - var coordinatorAddress string - if useTestCoordinator { - testCoordinator, err := contracts.DeployVRFCoordinatorTestV2(sethClient, linkTokenContract.Address(), bhs.Address(), linkEthFeedContract.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployCoordinatorV2, err) - } - coordinatorAddress = testCoordinator.Address() - } else { - coordinator, err := contracts.DeployVRFCoordinatorV2(sethClient, linkTokenContract.Address(), bhs.Address(), linkEthFeedContract.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployCoordinatorV2, err) - } - coordinatorAddress = coordinator.Address() - } - - coordinator, err := contracts.LoadVRFCoordinatorV2(sethClient, coordinatorAddress) - if err != nil { - return nil, fmt.Errorf("%s, err %w", vrfcommon.ErrLoadingCoordinator, err) - } - - batchCoordinator, err := contracts.DeployBatchVRFCoordinatorV2(sethClient, coordinator.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployBatchCoordinatorV2, err) - } - - if useVRFOwner { - vrfOwner, err := contracts.DeployVRFOwner(sethClient, coordinatorAddress) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployCoordinatorV2, err) - } - return &vrfcommon.VRFContracts{ - CoordinatorV2: coordinator, - BatchCoordinatorV2: batchCoordinator, - VRFOwner: vrfOwner, - BHS: bhs, - VRFV2Consumers: nil, - LinkToken: linkTokenContract, - MockETHLINKFeed: linkEthFeedContract, - }, nil - } - return &vrfcommon.VRFContracts{ - CoordinatorV2: coordinator, - BatchCoordinatorV2: batchCoordinator, - VRFOwner: nil, - BHS: bhs, - VRFV2Consumers: nil, - LinkToken: linkTokenContract, - MockETHLINKFeed: linkEthFeedContract, - }, nil -} - -func DeployVRFV2Consumers(sethClient *seth.Client, coordinatorAddress string, consumerContractsAmount int) ([]contracts.VRFv2LoadTestConsumer, error) { - var consumers []contracts.VRFv2LoadTestConsumer - for i := 1; i <= consumerContractsAmount; i++ { - loadTestConsumer, err := contracts.DeployVRFv2LoadTestConsumer(sethClient, coordinatorAddress) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrAdvancedConsumer, err) - } - consumers = append(consumers, loadTestConsumer) - } - return consumers, nil -} - -func DeployVRFV2WrapperConsumers(sethClient *seth.Client, linkTokenAddress string, vrfV2Wrapper contracts.VRFV2Wrapper, consumerContractsAmount int) ([]contracts.VRFv2WrapperLoadTestConsumer, error) { - var consumers []contracts.VRFv2WrapperLoadTestConsumer - for i := 1; i <= consumerContractsAmount; i++ { - loadTestConsumer, err := contracts.DeployVRFV2WrapperLoadTestConsumer(sethClient, linkTokenAddress, vrfV2Wrapper.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrAdvancedConsumer, err) - } - consumers = append(consumers, loadTestConsumer) - } - return consumers, nil -} - -func DeployVRFV2DirectFundingContracts( - sethClient *seth.Client, - linkTokenAddress string, - linkEthFeedAddress string, - coordinator contracts.VRFCoordinatorV2, - consumerContractsAmount int, -) (*VRFV2WrapperContracts, error) { - vrfv2Wrapper, err := contracts.DeployVRFV2Wrapper(sethClient, linkTokenAddress, linkEthFeedAddress, coordinator.Address()) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployVRFV2Wrapper, err) - } - consumers, err := DeployVRFV2WrapperConsumers(sethClient, linkTokenAddress, vrfv2Wrapper, consumerContractsAmount) - if err != nil { - return nil, err - } - return &VRFV2WrapperContracts{vrfv2Wrapper, consumers}, nil -} - -func VRFV2RegisterProvingKey( - vrfKey *nodeclient.VRFKey, - oracleAddress string, - coordinator contracts.VRFCoordinatorV2, -) (vrfcommon.VRFEncodedProvingKey, error) { - provingKey, err := actions.EncodeOnChainVRFProvingKey(*vrfKey) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf("%s, err %w", vrfcommon.ErrEncodingProvingKey, err) - } - err = coordinator.RegisterProvingKey( - oracleAddress, - provingKey, - ) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf("%s, err %w", vrfcommon.ErrRegisterProvingKey, err) - } - return provingKey, nil -} - -func SetupVRFV2Contracts( - sethClient *seth.Client, - linkToken contracts.LinkToken, - mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - useVRFOwner bool, - useTestCoordinator bool, - vrfv2Config *testconfig.General, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, error) { - l.Info().Msg("Deploying VRFV2 contracts") - vrfContracts, err := DeployVRFV2Contracts( - sethClient, - linkToken, - mockNativeLINKFeed, - useVRFOwner, - useTestCoordinator, - ) - if err != nil { - return nil, fmt.Errorf("%s, err %w", ErrDeployVRFV2Contracts, err) - } - - vrfCoordinatorV2FeeConfig := vrf_coordinator_v2.VRFCoordinatorV2FeeConfig{ - FulfillmentFlatFeeLinkPPMTier1: *vrfv2Config.FulfillmentFlatFeeLinkPPMTier1, - FulfillmentFlatFeeLinkPPMTier2: *vrfv2Config.FulfillmentFlatFeeLinkPPMTier2, - FulfillmentFlatFeeLinkPPMTier3: *vrfv2Config.FulfillmentFlatFeeLinkPPMTier3, - FulfillmentFlatFeeLinkPPMTier4: *vrfv2Config.FulfillmentFlatFeeLinkPPMTier4, - FulfillmentFlatFeeLinkPPMTier5: *vrfv2Config.FulfillmentFlatFeeLinkPPMTier5, - ReqsForTier2: big.NewInt(*vrfv2Config.ReqsForTier2), - ReqsForTier3: big.NewInt(*vrfv2Config.ReqsForTier3), - ReqsForTier4: big.NewInt(*vrfv2Config.ReqsForTier4), - ReqsForTier5: big.NewInt(*vrfv2Config.ReqsForTier5)} - - l.Info().Str("Coordinator", vrfContracts.CoordinatorV2.Address()).Msg("Setting Coordinator Config") - err = vrfContracts.CoordinatorV2.SetConfig( - *vrfv2Config.MinimumConfirmations, - *vrfv2Config.MaxGasLimitCoordinatorConfig, - *vrfv2Config.StalenessSeconds, - *vrfv2Config.GasAfterPaymentCalculation, - decimal.RequireFromString(*vrfv2Config.FallbackWeiPerUnitLink).BigInt(), - vrfCoordinatorV2FeeConfig, - ) - if err != nil { - return nil, fmt.Errorf("%s, err %w", vrfcommon.ErrSetVRFCoordinatorConfig, err) - } - return vrfContracts, nil -} - -func setupVRFOwnerContract(contracts *vrfcommon.VRFContracts, allNativeTokenKeyAddressStrings []string, allNativeTokenKeyAddresses []common.Address, l zerolog.Logger) error { - l.Info().Msg("Setting up VRFOwner contract") - l.Info(). - Str("Coordinator", contracts.CoordinatorV2.Address()). - Str("VRFOwner", contracts.VRFOwner.Address()). - Msg("Transferring ownership of Coordinator to VRFOwner") - err := contracts.CoordinatorV2.TransferOwnership(common.HexToAddress(contracts.VRFOwner.Address())) - if err != nil { - return nil - } - l.Info(). - Str("VRFOwner", contracts.VRFOwner.Address()). - Msg("Accepting VRF Ownership") - err = contracts.VRFOwner.AcceptVRFOwnership() - if err != nil { - return nil - } - l.Info(). - Strs("Authorized Senders", allNativeTokenKeyAddressStrings). - Str("VRFOwner", contracts.VRFOwner.Address()). - Msg("Setting authorized senders for VRFOwner contract") - err = contracts.VRFOwner.SetAuthorizedSenders(allNativeTokenKeyAddresses) - if err != nil { - return nil - } - return err -} - -func CreateFundSubsAndAddConsumers( - subscriptionFundingAmountLink *big.Float, - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2, - consumers []contracts.VRFv2LoadTestConsumer, - numberOfSubToCreate int, -) ([]uint64, error) { - subIDs, err := CreateSubsAndFund(subscriptionFundingAmountLink, linkToken, coordinator, numberOfSubToCreate) - if err != nil { - return nil, err - } - subToConsumersMap := map[uint64][]contracts.VRFv2LoadTestConsumer{} - - // each subscription will have the same consumers - for _, subID := range subIDs { - subToConsumersMap[subID] = consumers - } - - err = AddConsumersToSubs( - subToConsumersMap, - coordinator, - ) - if err != nil { - return nil, err - } - return subIDs, nil -} - -func CreateSubsAndFund( - subscriptionFundingAmountLink *big.Float, - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2, - subAmountToCreate int, -) ([]uint64, error) { - subs, err := CreateSubs(coordinator, subAmountToCreate) - if err != nil { - return nil, err - } - err = FundSubscriptions(subscriptionFundingAmountLink, linkToken, coordinator, subs) - if err != nil { - return nil, err - } - return subs, nil -} - -func CreateSubs( - coordinator contracts.VRFCoordinatorV2, - subAmountToCreate int, -) ([]uint64, error) { - var subIDArr []uint64 - - for range subAmountToCreate { - subID, err := CreateSubAndFindSubID(coordinator) - if err != nil { - return nil, err - } - subIDArr = append(subIDArr, subID) - } - return subIDArr, nil -} - -func AddConsumersToSubs( - subToConsumerMap map[uint64][]contracts.VRFv2LoadTestConsumer, - coordinator contracts.VRFCoordinatorV2, -) error { - for subID, consumers := range subToConsumerMap { - for _, consumer := range consumers { - err := coordinator.AddConsumer(subID, consumer.Address()) - if err != nil { - return fmt.Errorf("%s, err %w", vrfcommon.ErrAddConsumerToSub, err) - } - } - } - return nil -} - -func CreateSubAndFindSubID(coordinator contracts.VRFCoordinatorV2) (uint64, error) { - receipt, err := coordinator.CreateSubscription() - if err != nil { - return 0, fmt.Errorf("%s, err %w", vrfcommon.ErrCreateVRFSubscription, err) - } - // SubscriptionsCreated Log should be emitted with the subscription ID - subID := receipt.Logs[0].Topics[1].Big().Uint64() - - return subID, nil -} - -func FundSubscriptions( - subscriptionFundingAmountLink *big.Float, - linkAddress contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2, - subIDs []uint64, -) error { - for _, subID := range subIDs { - // Link Billing - amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) - err := FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) - if err != nil { - return fmt.Errorf("%s, err %w", vrfcommon.ErrFundSubWithLinkToken, err) - } - } - return nil -} - -func FundSubscriptionWithLink( - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2, - subscriptionID uint64, - linkFundingAmountJuels *big.Int, -) error { - encodedSubId, err := utils.ABIEncode(`[{"type":"uint64"}]`, subscriptionID) - if err != nil { - return fmt.Errorf("%s, err %w", vrfcommon.ErrABIEncodingFunding, err) - } - _, err = linkToken.TransferAndCall(coordinator.Address(), linkFundingAmountJuels, encodedSubId) - if err != nil { - return fmt.Errorf("%s, err %w", vrfcommon.ErrSendingLinkToken, err) - } - return nil -} - -func DirectFundingRequestRandomnessAndWaitForFulfillment( - l zerolog.Logger, - consumer contracts.VRFv2WrapperLoadTestConsumer, - coordinator contracts.Coordinator, - subID uint64, - vrfv2KeyData *vrfcommon.VRFKeyData, - minimumConfirmations uint16, - callbackGasLimit uint32, - numberOfWords uint32, - randomnessRequestCountPerRequest uint16, - randomnessRequestCountPerRequestDeviation uint16, - randomWordsFulfilledEventTimeout time.Duration, -) (*contracts.CoordinatorRandomWordsFulfilled, error) { - logRandRequest( - l, - consumer.Address(), - coordinator.Address(), - subID, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - randomnessRequestCountPerRequestDeviation, - vrfv2KeyData.KeyHash, - 0, - ) - randomWordsRequestedEvent, err := consumer.RequestRandomness( - coordinator, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - ) - if err != nil { - return nil, fmt.Errorf("%s, err %w", vrfcommon.ErrRequestRandomness, err) - } - fulfillmentEvents, err := WaitRandomWordsFulfilledEvent( - coordinator, - randomWordsRequestedEvent.RequestId, - randomWordsRequestedEvent.Raw.BlockNumber, - randomWordsFulfilledEventTimeout, - l, - ) - return fulfillmentEvents, err -} - -func RequestRandomnessAndWaitForFulfillment( - l zerolog.Logger, - consumer contracts.VRFv2LoadTestConsumer, - coordinator contracts.Coordinator, - subID uint64, - vrfKeyData *vrfcommon.VRFKeyData, - minimumConfirmations uint16, - callbackGasLimit uint32, - numberOfWords uint32, - randomnessRequestCountPerRequest uint16, - randomnessRequestCountPerRequestDeviation uint16, - randomWordsFulfilledEventTimeout time.Duration, - keyNum int, -) (*contracts.CoordinatorRandomWordsRequested, *contracts.CoordinatorRandomWordsFulfilled, error) { - randomWordsRequestedEvent, err := RequestRandomness( - l, - consumer, - coordinator, - subID, - vrfKeyData, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - randomnessRequestCountPerRequestDeviation, - keyNum, - ) - if err != nil { - return nil, nil, err - } - randomWordsFulfilledEvent, err := WaitRandomWordsFulfilledEvent( - coordinator, - randomWordsRequestedEvent.RequestId, - randomWordsRequestedEvent.Raw.BlockNumber, - randomWordsFulfilledEventTimeout, - l, - ) - if err != nil { - return nil, nil, err - } - return randomWordsRequestedEvent, randomWordsFulfilledEvent, nil -} - -func RequestRandomness( - l zerolog.Logger, - consumer contracts.VRFv2LoadTestConsumer, - coordinator contracts.Coordinator, - subID uint64, - vrfKeyData *vrfcommon.VRFKeyData, - minimumConfirmations uint16, - callbackGasLimit uint32, - numberOfWords uint32, - randomnessRequestCountPerRequest uint16, - randomnessRequestCountPerRequestDeviation uint16, - keyNum int, -) (*contracts.CoordinatorRandomWordsRequested, error) { - logRandRequest( - l, - consumer.Address(), - coordinator.Address(), - subID, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - randomnessRequestCountPerRequestDeviation, - vrfKeyData.KeyHash, - keyNum, - ) - randomWordsRequestedEvent, err := consumer.RequestRandomnessFromKey( - coordinator, - vrfKeyData.KeyHash, - subID, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - keyNum, - ) - if err != nil { - return nil, fmt.Errorf("%s, err %w", vrfcommon.ErrRequestRandomness, err) - } - vrfcommon.LogRandomnessRequestedEvent(l, coordinator, randomWordsRequestedEvent, false, keyNum) - - return randomWordsRequestedEvent, err -} - -func RequestRandomnessWithForceFulfillAndWaitForFulfillment( - l zerolog.Logger, - consumer contracts.VRFv2LoadTestConsumer, - coordinator contracts.Coordinator, - vrfOwner contracts.VRFOwner, - vrfv2KeyData *vrfcommon.VRFKeyData, - minimumConfirmations uint16, - callbackGasLimit uint32, - numberOfWords uint32, - randomnessRequestCountPerRequest uint16, - randomnessRequestCountPerRequestDeviation uint16, - subTopUpAmount *big.Int, - linkAddress common.Address, - randomWordsFulfilledEventTimeout time.Duration, -) (*contracts.CoordinatorConfigSet, *contracts.CoordinatorRandomWordsFulfilled, *vrf_owner.VRFOwnerRandomWordsForced, error) { - logRandRequest(l, consumer.Address(), coordinator.Address(), 0, minimumConfirmations, callbackGasLimit, numberOfWords, randomnessRequestCountPerRequest, randomnessRequestCountPerRequestDeviation, vrfv2KeyData.KeyHash, 0) - randomWordsRequestedEvent, err := consumer.RequestRandomWordsWithForceFulfill( - coordinator, - vrfv2KeyData.KeyHash, - minimumConfirmations, - callbackGasLimit, - numberOfWords, - randomnessRequestCountPerRequest, - subTopUpAmount, - linkAddress, - ) - if err != nil { - return nil, nil, nil, fmt.Errorf("%s, err %w", vrfcommon.ErrRequestRandomness, err) - } - - vrfcommon.LogRandomnessRequestedEvent(l, coordinator, randomWordsRequestedEvent, false, 0) - - errorChannel := make(chan error) - configSetEventChannel := make(chan *contracts.CoordinatorConfigSet) - randWordsFulfilledEventChannel := make(chan *contracts.CoordinatorRandomWordsFulfilled) - randWordsForcedEventChannel := make(chan *vrf_owner.VRFOwnerRandomWordsForced) - - go func() { - configSetEvent, err := coordinator.WaitForConfigSetEvent( - randomWordsFulfilledEventTimeout, - ) - if err != nil { - l.Error().Err(err).Msg("error waiting for ConfigSetEvent") - errorChannel <- err - } - configSetEventChannel <- configSetEvent - }() - - go func() { - randomWordsFulfilledEvent, err := coordinator.WaitForRandomWordsFulfilledEvent( - contracts.RandomWordsFulfilledEventFilter{ - RequestIds: []*big.Int{randomWordsRequestedEvent.RequestId}, - Timeout: randomWordsFulfilledEventTimeout, - }, - ) - if err != nil { - l.Error().Err(err).Msg("error waiting for RandomWordsFulfilledEvent") - errorChannel <- err - } - randWordsFulfilledEventChannel <- randomWordsFulfilledEvent - }() - - go func() { - randomWordsForcedEvent, err := vrfOwner.WaitForRandomWordsForcedEvent( - []*big.Int{randomWordsRequestedEvent.RequestId}, - nil, - nil, - randomWordsFulfilledEventTimeout, - ) - if err != nil { - l.Error().Err(err).Msg("error waiting for RandomWordsForcedEvent") - errorChannel <- err - } - randWordsForcedEventChannel <- randomWordsForcedEvent - }() - - var configSetEvent *contracts.CoordinatorConfigSet - var randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled - var randomWordsForcedEvent *vrf_owner.VRFOwnerRandomWordsForced - for range 3 { - select { - case err = <-errorChannel: - return nil, nil, nil, err - case configSetEvent = <-configSetEventChannel: - case randomWordsFulfilledEvent = <-randWordsFulfilledEventChannel: - vrfcommon.LogRandomWordsFulfilledEvent(l, coordinator, randomWordsFulfilledEvent, false, 0) - case randomWordsForcedEvent = <-randWordsForcedEventChannel: - vrfcommon.LogRandomWordsForcedEvent(l, vrfOwner, randomWordsForcedEvent) - case <-time.After(randomWordsFulfilledEventTimeout): - err = errors.New("timeout waiting for ConfigSet, RandomWordsFulfilled and RandomWordsForced events") - } - } - return configSetEvent, randomWordsFulfilledEvent, randomWordsForcedEvent, err -} - -func WaitRandomWordsFulfilledEvent( - coordinator contracts.Coordinator, - requestId *big.Int, - randomWordsRequestedEventBlockNumber uint64, - randomWordsFulfilledEventTimeout time.Duration, - l zerolog.Logger, -) (*contracts.CoordinatorRandomWordsFulfilled, error) { - randomWordsFulfilledEvent, err := coordinator.WaitForRandomWordsFulfilledEvent( - contracts.RandomWordsFulfilledEventFilter{ - RequestIds: []*big.Int{requestId}, - Timeout: randomWordsFulfilledEventTimeout, - }, - ) - if err != nil { - l.Warn(). - Str("requestID", requestId.String()). - Err(err).Msg("Error waiting for random words fulfilled event, trying to filter for the event") - randomWordsFulfilledEvent, err = coordinator.FilterRandomWordsFulfilledEvent( - &bind.FilterOpts{ - Start: randomWordsRequestedEventBlockNumber, - }, - requestId, - ) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFilterRandomWordsFulfilledEvent, err) - } - } - vrfcommon.LogRandomWordsFulfilledEvent(l, coordinator, randomWordsFulfilledEvent, false, 0) - return randomWordsFulfilledEvent, err -} - -func SetupVRFOwnerContractIfNeeded(useVRFOwner bool, vrfContracts *vrfcommon.VRFContracts, vrfTXKeyAddressStrings []string, vrfTXKeyAddresses []common.Address, l zerolog.Logger) (*vrfcommon.VRFOwnerConfig, error) { - var vrfOwnerConfig *vrfcommon.VRFOwnerConfig - if useVRFOwner { - err := setupVRFOwnerContract(vrfContracts, vrfTXKeyAddressStrings, vrfTXKeyAddresses, l) - if err != nil { - return nil, err - } - vrfOwnerConfig = &vrfcommon.VRFOwnerConfig{ - OwnerAddress: vrfContracts.VRFOwner.Address(), - UseVRFOwner: useVRFOwner, - } - } else { - vrfOwnerConfig = &vrfcommon.VRFOwnerConfig{ - OwnerAddress: "", - UseVRFOwner: useVRFOwner, - } - } - return vrfOwnerConfig, nil -} - -func SetupNewConsumersAndSubs( - sethClient *seth.Client, - coordinator contracts.VRFCoordinatorV2, - testConfig tc.TestConfig, - linkToken contracts.LinkToken, - numberOfConsumerContractsToDeployAndAddToSub int, - numberOfSubToCreate int, - l zerolog.Logger, -) ([]contracts.VRFv2LoadTestConsumer, []uint64, error) { - consumers, err := DeployVRFV2Consumers(sethClient, coordinator.Address(), numberOfConsumerContractsToDeployAndAddToSub) - if err != nil { - return nil, nil, err - } - l.Info(). - Str("Coordinator", *testConfig.VRFv2.ExistingEnvConfig.ExistingEnvConfig.CoordinatorAddress). - Int("Number of Subs to create", numberOfSubToCreate). - Msg("Creating and funding subscriptions, deploying and adding consumers to subs") - subIDs, err := CreateFundSubsAndAddConsumers( - big.NewFloat(*testConfig.VRFv2.General.SubscriptionFundingAmountLink), - linkToken, - coordinator, - consumers, - numberOfSubToCreate, - ) - if err != nil { - return nil, nil, err - } - return consumers, subIDs, nil -} - -func CancelSubsAndReturnFunds(ctx context.Context, vrfContracts *vrfcommon.VRFContracts, eoaWalletAddress string, subIDs []uint64, l zerolog.Logger) { - for _, subID := range subIDs { - l.Info(). - Uint64("Returning funds from SubID", subID). - Str("Returning funds to", eoaWalletAddress). - Msg("Canceling subscription and returning funds to subscription owner") - pendingRequestsExist, err := vrfContracts.CoordinatorV2.PendingRequestsExist(ctx, subID) - if err != nil { - l.Error().Err(err).Msg("Error checking if pending requests exist") - } - if !pendingRequestsExist { - _, _, err := vrfContracts.CoordinatorV2.CancelSubscription(subID, common.HexToAddress(eoaWalletAddress)) - if err != nil { - l.Error().Err(err).Msg("Error canceling subscription") - } - } else { - l.Error().Uint64("Sub ID", subID).Msg("Pending requests exist for subscription, cannot cancel subscription and return funds") - } - } -} diff --git a/integration-tests/actions/vrf/vrfv2/errors.go b/integration-tests/actions/vrf/vrfv2/errors.go deleted file mode 100644 index dc98270ad4c..00000000000 --- a/integration-tests/actions/vrf/vrfv2/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package vrfv2 - -const ( - ErrDeployCoordinatorV2 = "error deploying VRF CoordinatorV2" - ErrDeployBatchCoordinatorV2 = "error deploying Batch VRF CoordinatorV2" - ErrDeployVRFV2Wrapper = "error deploying VRFV2Wrapper" - ErrCreateVRFV2Jobs = "error creating VRF V2 Jobs" - ErrDeployVRFV2Contracts = "error deploying VRFV2 contracts" - ErrCreatingVRFv2Job = "error creating VRFv2 job" - ErrAdvancedConsumer = "error deploying VRFv2 Advanced Consumer" -) diff --git a/integration-tests/actions/vrf/vrfv2/logging_helpers.go b/integration-tests/actions/vrf/vrfv2/logging_helpers.go deleted file mode 100644 index ea6e15b2ff5..00000000000 --- a/integration-tests/actions/vrf/vrfv2/logging_helpers.go +++ /dev/null @@ -1,34 +0,0 @@ -package vrfv2 - -import ( - "fmt" - - "github.com/rs/zerolog" -) - -func logRandRequest( - l zerolog.Logger, - consumer string, - coordinator string, - subID uint64, - minimumConfirmations uint16, - callbackGasLimit uint32, - numberOfWords uint32, - randomnessRequestCountPerRequest uint16, - randomnessRequestCountPerRequestDeviation uint16, - keyhash [32]byte, - keyNum int, -) { - l.Info(). - Int("KeyNum", keyNum). - Str("Consumer", consumer). - Str("Coordinator", coordinator). - Uint64("SubID", subID). - Uint16("MinimumConfirmations", minimumConfirmations). - Uint32("CallbackGasLimit", callbackGasLimit). - Uint32("NumberOfWords", numberOfWords). - Uint16("RandomnessRequestCountPerRequest", randomnessRequestCountPerRequest). - Uint16("RandomnessRequestCountPerRequestDeviation", randomnessRequestCountPerRequestDeviation). - Str("Keyhash", fmt.Sprintf("0x%x", keyhash)). - Msg("Requesting randomness") -} diff --git a/integration-tests/actions/vrf/vrfv2/models.go b/integration-tests/actions/vrf/vrfv2/models.go deleted file mode 100644 index 3216af49904..00000000000 --- a/integration-tests/actions/vrf/vrfv2/models.go +++ /dev/null @@ -1,10 +0,0 @@ -package vrfv2 - -import ( - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -type VRFV2WrapperContracts struct { - VRFV2Wrapper contracts.VRFV2Wrapper - LoadTestConsumers []contracts.VRFv2WrapperLoadTestConsumer -} diff --git a/integration-tests/actions/vrf/vrfv2/setup_steps.go b/integration-tests/actions/vrf/vrfv2/setup_steps.go deleted file mode 100644 index fd2f024f9cd..00000000000 --- a/integration-tests/actions/vrf/vrfv2/setup_steps.go +++ /dev/null @@ -1,470 +0,0 @@ -package vrfv2 - -import ( - "context" - "fmt" - "math/big" - "testing" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog" - "golang.org/x/sync/errgroup" - - "github.com/google/uuid" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - testconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2" - - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - vrfcommon "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/common" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - "github.com/smartcontractkit/chainlink/integration-tests/types" -) - -func CreateVRFV2Job( - chainlinkNode *nodeclient.ChainlinkClient, - vrfJobSpecConfig vrfcommon.VRFJobSpecConfig, -) (*nodeclient.Job, error) { - jobUUID := uuid.New() - os := &nodeclient.VRFV2TxPipelineSpec{ - Address: vrfJobSpecConfig.CoordinatorAddress, - EstimateGasMultiplier: vrfJobSpecConfig.EstimateGasMultiplier, - FromAddress: vrfJobSpecConfig.FromAddresses[0], - SimulationBlock: vrfJobSpecConfig.SimulationBlock, - } - ost, err := os.String() - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrParseJob, err) - } - - spec := &nodeclient.VRFV2JobSpec{ - Name: fmt.Sprintf("vrf-v2-%s", jobUUID), - ForwardingAllowed: vrfJobSpecConfig.ForwardingAllowed, - CoordinatorAddress: vrfJobSpecConfig.CoordinatorAddress, - FromAddresses: vrfJobSpecConfig.FromAddresses, - EVMChainID: vrfJobSpecConfig.EVMChainID, - MinIncomingConfirmations: vrfJobSpecConfig.MinIncomingConfirmations, - PublicKey: vrfJobSpecConfig.PublicKey, - ExternalJobID: jobUUID.String(), - ObservationSource: ost, - BatchFulfillmentEnabled: vrfJobSpecConfig.BatchFulfillmentEnabled, - BatchFulfillmentGasMultiplier: vrfJobSpecConfig.BatchFulfillmentGasMultiplier, - PollPeriod: vrfJobSpecConfig.PollPeriod, - RequestTimeout: vrfJobSpecConfig.RequestTimeout, - } - if vrfJobSpecConfig.VRFOwnerConfig.UseVRFOwner { - spec.VRFOwner = vrfJobSpecConfig.VRFOwnerConfig.OwnerAddress - spec.UseVRFOwner = true - } - if vrfJobSpecConfig.BatchFulfillmentEnabled { - spec.BatchCoordinatorAddress = vrfJobSpecConfig.BatchCoordinatorAddress - } - job, err := chainlinkNode.MustCreateJob(spec) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrCreatingVRFv2Job, err) - } - return job, nil -} - -// SetupVRFV2Environment will create specified number of subscriptions and add the same conumer/s to each of them -func SetupVRFV2Environment( - ctx context.Context, - sethClient *seth.Client, - env *test_env.CLClusterTestEnv, - chainID int64, - nodesToCreate []vrfcommon.VRFNodeType, - vrfv2TestConfig types.VRFv2TestConfig, - useVRFOwner bool, - useTestCoordinator bool, - linkToken contracts.LinkToken, - mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - registerProvingKeyAgainstAddress string, - numberOfTxKeysToCreate int, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, error) { - l.Info().Msg("Starting VRFV2 environment setup") - configGeneral := vrfv2TestConfig.GetVRFv2Config().General - vrfContracts, err := SetupVRFV2Contracts( - sethClient, - linkToken, - mockNativeLINKFeed, - useVRFOwner, - useTestCoordinator, - configGeneral, - l, - ) - if err != nil { - return nil, nil, nil, err - } - - nodeTypeToNodeMap, err := vrfcommon.CreateNodeTypeToNodeMap(env.ClCluster, nodesToCreate) - if err != nil { - return nil, nil, nil, err - } - vrfKey, pubKeyCompressed, err := vrfcommon.CreateVRFKeyOnVRFNode(nodeTypeToNodeMap[vrfcommon.VRF], l) - if err != nil { - return nil, nil, nil, err - } - l.Info().Str("Coordinator", vrfContracts.CoordinatorV2.Address()).Msg("Registering Proving Key") - provingKey, err := VRFV2RegisterProvingKey(vrfKey, registerProvingKeyAgainstAddress, vrfContracts.CoordinatorV2) - if err != nil { - return nil, nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRegisteringProvingKey, err) - } - keyHash, err := vrfContracts.CoordinatorV2.HashOfKey(ctx, provingKey) - if err != nil { - return nil, nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrCreatingProvingKeyHash, err) - } - - vrfTXKeyAddressStrings, vrfTXKeyAddresses, err := vrfcommon.CreateFundAndGetSendingKeys( - l, - sethClient, - nodeTypeToNodeMap[vrfcommon.VRF], - *vrfv2TestConfig.GetCommonConfig().ChainlinkNodeFunding, - numberOfTxKeysToCreate, - big.NewInt(chainID), - ) - if err != nil { - return nil, nil, nil, err - } - - nodeTypeToNodeMap[vrfcommon.VRF].TXKeyAddressStrings = vrfTXKeyAddressStrings - - vrfOwnerConfig, err := SetupVRFOwnerContractIfNeeded(useVRFOwner, vrfContracts, vrfTXKeyAddressStrings, vrfTXKeyAddresses, l) - if err != nil { - return nil, nil, nil, err - } - - g := errgroup.Group{} - if vrfNode, exists := nodeTypeToNodeMap[vrfcommon.VRF]; exists { - g.Go(func() error { - err := setupVRFNode(vrfContracts, big.NewInt(chainID), configGeneral, pubKeyCompressed, vrfOwnerConfig, l, vrfNode) - if err != nil { - return err - } - return nil - }) - } - - if bhsNode, exists := nodeTypeToNodeMap[vrfcommon.BHS]; exists { - g.Go(func() error { - err := vrfcommon.SetupBHSNode( - sethClient, - configGeneral.General, - numberOfTxKeysToCreate, - big.NewInt(chainID), - vrfContracts.CoordinatorV2.Address(), - vrfContracts.BHS.Address(), - *vrfv2TestConfig.GetCommonConfig().ChainlinkNodeFunding, - l, - bhsNode, - ) - if err != nil { - return err - } - return nil - }) - } - - if err := g.Wait(); err != nil { - return nil, nil, nil, fmt.Errorf("VRF node setup ended up with an error: %w", err) - } - - vrfKeyData := vrfcommon.VRFKeyData{ - VRFKey: vrfKey, - EncodedProvingKey: provingKey, - KeyHash: keyHash, - PubKeyCompressed: pubKeyCompressed, - } - - l.Info().Msg("VRFV2 environment setup is finished") - return vrfContracts, &vrfKeyData, nodeTypeToNodeMap, nil -} - -func setupVRFNode(contracts *vrfcommon.VRFContracts, chainID *big.Int, config *testconfig.General, pubKeyCompressed string, vrfOwnerConfig *vrfcommon.VRFOwnerConfig, l zerolog.Logger, vrfNode *vrfcommon.VRFNode) error { - vrfJobSpecConfig := vrfcommon.VRFJobSpecConfig{ - ForwardingAllowed: *config.VRFJobForwardingAllowed, - CoordinatorAddress: contracts.CoordinatorV2.Address(), - BatchCoordinatorAddress: contracts.BatchCoordinatorV2.Address(), - FromAddresses: vrfNode.TXKeyAddressStrings, - EVMChainID: chainID.String(), - MinIncomingConfirmations: int(*config.MinimumConfirmations), - PublicKey: pubKeyCompressed, - EstimateGasMultiplier: *config.VRFJobEstimateGasMultiplier, - BatchFulfillmentEnabled: *config.VRFJobBatchFulfillmentEnabled, - BatchFulfillmentGasMultiplier: *config.VRFJobBatchFulfillmentGasMultiplier, - PollPeriod: config.VRFJobPollPeriod.Duration, - RequestTimeout: config.VRFJobRequestTimeout.Duration, - SimulationBlock: config.VRFJobSimulationBlock, - VRFOwnerConfig: vrfOwnerConfig, - } - - l.Info().Msg("Creating VRFV2 Job") - job, err := CreateVRFV2Job( - vrfNode.CLNode.API, - vrfJobSpecConfig, - ) - if err != nil { - return fmt.Errorf("%s, err %w", ErrCreateVRFV2Jobs, err) - } - vrfNode.Job = job - - // this part is here because VRFv2 can work with only a specific key - // [[EVM.KeySpecific]] - // Key = '...' - nodeConfig := node.NewConfig(vrfNode.CLNode.NodeConfig, - node.WithKeySpecificMaxGasPrice(vrfNode.TXKeyAddressStrings, *config.CLNodeMaxGasPriceGWei), - ) - l.Info(). - Strs("Sending Keys", vrfNode.TXKeyAddressStrings). - Int64("Price Max Setting", *config.CLNodeMaxGasPriceGWei). - Msg("Restarting Node with new sending key PriceMax configuration") - err = vrfNode.CLNode.Restart(nodeConfig) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRestartCLNode, err) - } - return nil -} - -func SetupVRFV2WrapperEnvironment( - ctx context.Context, - sethClient *seth.Client, - vrfv2TestConfig tc.VRFv2TestConfig, - linkToken contracts.LinkToken, - mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - coordinator contracts.VRFCoordinatorV2, - keyHash [32]byte, - wrapperConsumerContractsAmount int, -) (*VRFV2WrapperContracts, *uint64, error) { - // Deploy VRF v2 direct funding contracts - wrapperContracts, err := DeployVRFV2DirectFundingContracts( - sethClient, - linkToken.Address(), - mockNativeLINKFeed.Address(), - coordinator, - wrapperConsumerContractsAmount, - ) - if err != nil { - return nil, nil, err - } - - vrfv2Config := vrfv2TestConfig.GetVRFv2Config() - - // Configure VRF v2 wrapper contract - err = wrapperContracts.VRFV2Wrapper.SetConfig( - *vrfv2Config.General.WrapperGasOverhead, - *vrfv2Config.General.CoordinatorGasOverhead, - *vrfv2Config.General.WrapperPremiumPercentage, - keyHash, - *vrfv2Config.General.WrapperMaxNumberOfWords, - ) - if err != nil { - return nil, nil, err - } - - // Fetch wrapper subscription ID - wrapperSubID, err := wrapperContracts.VRFV2Wrapper.GetSubID(ctx) - if err != nil { - return nil, nil, err - } - - // Fund wrapper subscription - err = FundSubscriptions(big.NewFloat(*vrfv2Config.General.SubscriptionFundingAmountLink), linkToken, coordinator, []uint64{wrapperSubID}) - if err != nil { - return nil, nil, err - } - - // Fund consumer with LINK - err = linkToken.Transfer( - wrapperContracts.LoadTestConsumers[0].Address(), - big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(*vrfv2Config.General.WrapperConsumerFundingAmountLink)), - ) - if err != nil { - return nil, nil, err - } - - return wrapperContracts, &wrapperSubID, nil -} - -func SetupVRFV2Universe( - ctx context.Context, - t *testing.T, - envConfig vrfcommon.VRFEnvConfig, - newEnvConfig vrfcommon.NewEnvConfig, - l zerolog.Logger, -) (*test_env.CLClusterTestEnv, *vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, *seth.Client, error) { - var ( - env *test_env.CLClusterTestEnv - vrfContracts *vrfcommon.VRFContracts - vrfKey *vrfcommon.VRFKeyData - nodeTypeToNodeMap map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode - sethClient *seth.Client - err error - ) - if *envConfig.TestConfig.VRFv2.General.UseExistingEnv { - vrfContracts, vrfKey, env, sethClient, err = SetupVRFV2ForExistingEnv(t, envConfig, l) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error setting up VRF V2 for Existing env", err) - } - } else { - vrfContracts, vrfKey, env, nodeTypeToNodeMap, sethClient, err = SetupVRFV2ForNewEnv(ctx, t, envConfig, newEnvConfig, l) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error setting up VRF V2 for New env", err) - } - } - - return env, vrfContracts, vrfKey, nodeTypeToNodeMap, sethClient, nil -} - -func SetupVRFV2ForNewEnv( - ctx context.Context, - t *testing.T, - envConfig vrfcommon.VRFEnvConfig, - newEnvConfig vrfcommon.NewEnvConfig, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, *test_env.CLClusterTestEnv, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, *seth.Client, error) { - network, err := actions.EthereumNetworkConfigFromConfig(l, &envConfig.TestConfig) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error building ethereum network config for V2", err) - } - env, sethClient, err := vrfcommon.BuildNewCLEnvForVRF(l, t, envConfig, newEnvConfig, network) - if err != nil { - return nil, nil, nil, nil, nil, err - } - mockETHLinkFeed, err := contracts.DeployVRFMockETHLINKFeed(sethClient, big.NewInt(*envConfig.TestConfig.VRFv2.General.LinkNativeFeedResponse)) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error deploying mock ETH/LINK feed", err) - } - linkToken, err := contracts.DeployLinkTokenContract(l, sethClient) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error deploying LINK contract", err) - } - vrfContracts, vrfKey, nodeTypeToNode, err := SetupVRFV2Environment( - ctx, - sethClient, - env, - envConfig.ChainID, - newEnvConfig.NodesToCreate, - &envConfig.TestConfig, - newEnvConfig.UseVRFOwner, - newEnvConfig.UseTestCoordinator, - linkToken, - mockETHLinkFeed, - // register proving key against EOA address in order to return funds to this address - sethClient.MustGetRootKeyAddress().Hex(), - newEnvConfig.NumberOfTxKeysToCreate, - l, - ) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error setting up VRF v2 env", err) - } - - return vrfContracts, vrfKey, env, nodeTypeToNode, sethClient, nil -} - -func SetupVRFV2ForExistingEnv(t *testing.T, envConfig vrfcommon.VRFEnvConfig, l zerolog.Logger) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, *test_env.CLClusterTestEnv, *seth.Client, error) { - commonExistingEnvConfig := envConfig.TestConfig.VRFv2.ExistingEnvConfig.ExistingEnvConfig - env, sethClient, err := vrfcommon.LoadExistingCLEnvForVRF( - t, - envConfig, - commonExistingEnvConfig, - l, - ) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading existing CL env", err) - } - coordinator, err := contracts.LoadVRFCoordinatorV2(sethClient, *commonExistingEnvConfig.CoordinatorAddress) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading VRFCoordinator2", err) - } - linkAddress, err := coordinator.GetLinkAddress(testcontext.Get(t)) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error getting Link address from Coordinator", err) - } - linkToken, err := contracts.LoadLinkTokenContract(l, sethClient, common.HexToAddress(linkAddress.String())) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading LinkToken", err) - } - blockHashStoreAddress, err := coordinator.GetBlockHashStoreAddress(testcontext.Get(t)) - if err != nil { - return nil, nil, nil, nil, err - } - blockHashStore, err := contracts.LoadBlockHashStore(sethClient, blockHashStoreAddress.String()) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading BlockHashStore", err) - } - vrfContracts := &vrfcommon.VRFContracts{ - CoordinatorV2: coordinator, - VRFV2Consumers: nil, - LinkToken: linkToken, - BHS: blockHashStore, - } - vrfKey := &vrfcommon.VRFKeyData{ - VRFKey: nil, - EncodedProvingKey: [2]*big.Int{}, - KeyHash: common.HexToHash(*commonExistingEnvConfig.KeyHash), - } - return vrfContracts, vrfKey, env, sethClient, nil -} - -func SetupSubsAndConsumersForExistingEnv( - sethClient *seth.Client, - coordinator contracts.VRFCoordinatorV2, - linkToken contracts.LinkToken, - numberOfConsumerContractsToDeployAndAddToSub int, - numberOfSubToCreate int, - testConfig tc.TestConfig, - l zerolog.Logger, -) ([]uint64, []contracts.VRFv2LoadTestConsumer, error) { - var ( - subIDs []uint64 - consumers []contracts.VRFv2LoadTestConsumer - err error - ) - if *testConfig.VRFv2.General.UseExistingEnv { - commonExistingEnvConfig := testConfig.VRFv2.ExistingEnvConfig.ExistingEnvConfig - if *commonExistingEnvConfig.CreateFundSubsAndAddConsumers { - consumers, subIDs, err = SetupNewConsumersAndSubs( - sethClient, - coordinator, - testConfig, - linkToken, - numberOfConsumerContractsToDeployAndAddToSub, - numberOfSubToCreate, - l, - ) - if err != nil { - return nil, nil, err - } - } else { - addr := common.HexToAddress(*commonExistingEnvConfig.ConsumerAddress) - consumer, err := contracts.LoadVRFv2LoadTestConsumer(sethClient, addr) - if err != nil { - return nil, nil, err - } - consumers = append(consumers, consumer) - subIDs = append(subIDs, *testConfig.VRFv2.ExistingEnvConfig.SubID) - } - } else { - consumers, subIDs, err = SetupNewConsumersAndSubs( - sethClient, - coordinator, - testConfig, - linkToken, - numberOfConsumerContractsToDeployAndAddToSub, - numberOfSubToCreate, - l, - ) - if err != nil { - return nil, nil, err - } - } - return subIDs, consumers, nil -} diff --git a/integration-tests/actions/vrf/vrfv2plus/contract_steps.go b/integration-tests/actions/vrf/vrfv2plus/contract_steps.go deleted file mode 100644 index 89dd49dd0e3..00000000000 --- a/integration-tests/actions/vrf/vrfv2plus/contract_steps.go +++ /dev/null @@ -1,737 +0,0 @@ -package vrfv2plus - -import ( - "context" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog" - "github.com/shopspring/decimal" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - vrfcommon "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/common" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - vrfv2plusconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" - - "github.com/smartcontractkit/chainlink-evm/pkg/utils" -) - -func DeployVRFV2_5Contracts( - chainClient *seth.Client, - configGeneral *vrfv2plusconfig.General, -) (*vrfcommon.VRFContracts, error) { - bhs, err := contracts.DeployBlockhashStore(chainClient) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrDeployBlockHashStore, err) - } - batchBHS, err := contracts.DeployBatchBlockhashStore(chainClient, bhs.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrDeployBatchBlockHashStore, err) - } - var coordinator contracts.VRFCoordinatorV2_5 - if actions.IsOPStackChain(chainClient.ChainID) { - opStackCoordinator, err := contracts.DeployVRFCoordinatorV2_5_Optimism(chainClient, bhs.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployCoordinatorV2Plus, err) - } - err = opStackCoordinator.SetL1FeeCalculation(*configGeneral.L1FeeCalculationMode, *configGeneral.L1FeeCoefficient) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrSetL1FeeCalculation, err) - } - coordinator, err = contracts.LoadVRFCoordinatorV2_5(chainClient, opStackCoordinator.Address.String()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrLoadingCoordinator, err) - } - } else if actions.IsArbitrumChain(chainClient.ChainID) { - arbitrumCoordinator, err := contracts.DeployVRFCoordinatorV2_5_Arbitrum(chainClient, bhs.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployCoordinatorV2Plus, err) - } - coordinator, err = contracts.LoadVRFCoordinatorV2_5(chainClient, arbitrumCoordinator.Address.String()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrLoadingCoordinator, err) - } - } else if *configGeneral.UseTestCoordinator { - testCoordinator, err := contracts.DeployVRFCoordinatorTestV2_5(chainClient, bhs.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployCoordinatorV2Plus, err) - } - coordinator, err = contracts.LoadVRFCoordinatorV2_5(chainClient, testCoordinator.Address.String()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrLoadingCoordinator, err) - } - } else { - coordinator, err = contracts.DeployVRFCoordinatorV2_5(chainClient, bhs.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployCoordinatorV2Plus, err) - } - } - batchCoordinator, err := contracts.DeployBatchVRFCoordinatorV2Plus(chainClient, coordinator.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployBatchCoordinatorV2Plus, err) - } - return &vrfcommon.VRFContracts{ - CoordinatorV2Plus: coordinator, - BatchCoordinatorV2Plus: batchCoordinator, - BHS: bhs, - BatchBHS: batchBHS, - VRFV2PlusConsumer: nil, - }, nil -} - -func DeployVRFV2PlusConsumers(client *seth.Client, coordinator contracts.VRFCoordinatorV2_5, consumerContractsAmount int) ([]contracts.VRFv2PlusLoadTestConsumer, error) { - var consumers []contracts.VRFv2PlusLoadTestConsumer - for i := 1; i <= consumerContractsAmount; i++ { - loadTestConsumer, err := contracts.DeployVRFv2PlusLoadTestConsumer(client, coordinator.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrAdvancedConsumer, err) - } - consumers = append(consumers, loadTestConsumer) - } - return consumers, nil -} - -func VRFV2_5RegisterProvingKey( - vrfKey *nodeclient.VRFKey, - coordinator contracts.VRFCoordinatorV2_5, - gasLaneMaxGas uint64, -) (vrfcommon.VRFEncodedProvingKey, error) { - provingKey, err := actions.EncodeOnChainVRFProvingKey(*vrfKey) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrEncodingProvingKey, err) - } - err = coordinator.RegisterProvingKey( - provingKey, - gasLaneMaxGas, - ) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRegisterProvingKey, err) - } - return provingKey, nil -} - -func VRFV2PlusUpgradedVersionRegisterProvingKey( - vrfKey *nodeclient.VRFKey, - coordinator contracts.VRFCoordinatorV2PlusUpgradedVersion, - gasLaneMaxGasPrice uint64, -) (vrfcommon.VRFEncodedProvingKey, error) { - provingKey, err := actions.EncodeOnChainVRFProvingKey(*vrfKey) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrEncodingProvingKey, err) - } - err = coordinator.RegisterProvingKey( - provingKey, - gasLaneMaxGasPrice, - ) - if err != nil { - return vrfcommon.VRFEncodedProvingKey{}, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRegisterProvingKey, err) - } - return provingKey, nil -} - -func FundSubscriptionWithLink( - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2_5, - subscriptionID *big.Int, - linkFundingAmountJuels *big.Int, -) error { - encodedSubId, err := utils.ABIEncode(`[{"type":"uint256"}]`, subscriptionID) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrABIEncodingFunding, err) - } - _, err = linkToken.TransferAndCall(coordinator.Address(), linkFundingAmountJuels, encodedSubId) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrSendingLinkToken, err) - } - return nil -} - -func CreateFundSubsAndAddConsumers( - ctx context.Context, - sethClient *seth.Client, - subscriptionFundingAmountNative *big.Float, - subscriptionFundingAmountLink *big.Float, - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2_5, - consumers []contracts.VRFv2PlusLoadTestConsumer, - numberOfSubToCreate int, - subFundingType string, -) ([]*big.Int, error) { - subIDs, err := CreateSubsAndFund( - ctx, - sethClient, - subscriptionFundingAmountNative, - subscriptionFundingAmountLink, - linkToken, - coordinator, - numberOfSubToCreate, - subFundingType, - ) - if err != nil { - return nil, err - } - subToConsumersMap := map[*big.Int][]contracts.VRFv2PlusLoadTestConsumer{} - - // each subscription will have the same consumers - for _, subID := range subIDs { - subToConsumersMap[subID] = consumers - } - - err = AddConsumersToSubs( - subToConsumersMap, - coordinator, - ) - - return subIDs, err -} - -func CreateSubsAndFund( - ctx context.Context, - sethClient *seth.Client, - subscriptionFundingAmountNative *big.Float, - subscriptionFundingAmountLink *big.Float, - linkToken contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2_5, - numberOfSubsToCreate int, - subFundingType string, -) ([]*big.Int, error) { - subs, err := CreateSubs(ctx, sethClient, coordinator, numberOfSubsToCreate) - if err != nil { - return nil, err - } - err = FundSubscriptions( - subscriptionFundingAmountNative, - subscriptionFundingAmountLink, - linkToken, - coordinator, - subs, - subFundingType, - ) - if err != nil { - return nil, err - } - return subs, nil -} - -func CreateSubs( - ctx context.Context, - sethClient *seth.Client, - coordinator contracts.VRFCoordinatorV2_5, - subAmountToCreate int, -) ([]*big.Int, error) { - var subIDArr []*big.Int - - for range subAmountToCreate { - subID, err := CreateSubAndFindSubID(ctx, sethClient, coordinator) - if err != nil { - return nil, err - } - subIDArr = append(subIDArr, subID) - } - return subIDArr, nil -} - -func AddConsumersToSubs( - subToConsumerMap map[*big.Int][]contracts.VRFv2PlusLoadTestConsumer, - coordinator contracts.VRFCoordinatorV2_5, -) error { - for subID, consumers := range subToConsumerMap { - for _, consumer := range consumers { - err := coordinator.AddConsumer(subID, consumer.Address()) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrAddConsumerToSub, err) - } - } - } - return nil -} - -func CreateSubAndFindSubID(ctx context.Context, sethClient *seth.Client, coordinator contracts.VRFCoordinatorV2_5) (*big.Int, error) { - tx, err := coordinator.CreateSubscription() - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrCreateVRFSubscription, err) - } - receipt, err := sethClient.Client.TransactionReceipt(ctx, tx.Hash()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrWaitTXsComplete, err) - } - - // SubscriptionsCreated Log should be emitted with the subscription ID - subID := receipt.Logs[0].Topics[1].Big() - - return subID, nil -} - -func FundSubscriptions( - subscriptionFundingAmountNative *big.Float, - subscriptionFundingAmountLink *big.Float, - linkAddress contracts.LinkToken, - coordinator contracts.VRFCoordinatorV2_5, - subIDs []*big.Int, - subFundingType string, -) error { - for _, subID := range subIDs { - switch vrfv2plusconfig.BillingType(subFundingType) { - case vrfv2plusconfig.BillingType_Link: - amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) - err := FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFundSubWithLinkToken, err) - } - case vrfv2plusconfig.BillingType_Native: - amountWei := conversions.EtherToWei(subscriptionFundingAmountNative) - err := coordinator.FundSubscriptionWithNative( - subID, - amountWei, - ) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrFundSubWithNativeToken, err) - } - case vrfv2plusconfig.BillingType_Link_and_Native: - // Native Billing - amountWei := conversions.EtherToWei(subscriptionFundingAmountNative) - err := coordinator.FundSubscriptionWithNative( - subID, - amountWei, - ) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrFundSubWithNativeToken, err) - } - // Link Billing - amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) - err = FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFundSubWithLinkToken, err) - } - default: - return fmt.Errorf("invalid billing type: %s", subFundingType) - } - } - return nil -} - -func GetUpgradedCoordinatorTotalBalance(coordinator contracts.VRFCoordinatorV2PlusUpgradedVersion) (linkTotalBalance *big.Int, nativeTokenTotalBalance *big.Int, err error) { - linkTotalBalance, err = coordinator.GetLinkTotalBalance(context.Background()) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrLinkTotalBalance, err) - } - nativeTokenTotalBalance, err = coordinator.GetNativeTokenTotalBalance(context.Background()) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrNativeTokenBalance, err) - } - return -} - -func GetCoordinatorTotalBalance(coordinator contracts.VRFCoordinatorV2_5) (linkTotalBalance *big.Int, nativeTokenTotalBalance *big.Int, err error) { - linkTotalBalance, err = coordinator.GetLinkTotalBalance(context.Background()) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrLinkTotalBalance, err) - } - nativeTokenTotalBalance, err = coordinator.GetNativeTokenTotalBalance(context.Background()) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrNativeTokenBalance, err) - } - return -} - -func RequestRandomness( - consumer contracts.VRFv2PlusLoadTestConsumer, - coordinator contracts.Coordinator, - vrfKeyData *vrfcommon.VRFKeyData, - subID *big.Int, - isNativeBilling bool, - config *vrfv2plusconfig.General, - l zerolog.Logger, - keyNum int, -) (*contracts.CoordinatorRandomWordsRequested, error) { - LogRandRequest( - l, - consumer.Address(), - coordinator.Address(), - subID, - isNativeBilling, - vrfKeyData.KeyHash, - config, - keyNum, - ) - randomWordsRequestedEvent, err := consumer.RequestRandomnessFromKey( - coordinator, - vrfKeyData.KeyHash, - subID, - *config.MinimumConfirmations, - *config.CallbackGasLimit, - isNativeBilling, - *config.NumberOfWords, - *config.RandomnessRequestCountPerRequest, - keyNum, - ) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRequestRandomness, err) - } - vrfcommon.LogRandomnessRequestedEvent(l, coordinator, randomWordsRequestedEvent, isNativeBilling, keyNum) - - return randomWordsRequestedEvent, err -} - -func RequestRandomnessAndWaitForFulfillment( - consumer contracts.VRFv2PlusLoadTestConsumer, - coordinator contracts.Coordinator, - vrfKeyData *vrfcommon.VRFKeyData, - subID *big.Int, - isNativeBilling bool, - config *vrfv2plusconfig.General, - l zerolog.Logger, - keyNum int, -) (*contracts.CoordinatorRandomWordsRequested, *contracts.CoordinatorRandomWordsFulfilled, error) { - randomWordsRequestedEvent, err := RequestRandomness( - consumer, - coordinator, - vrfKeyData, - subID, - isNativeBilling, - config, - l, - keyNum, - ) - if err != nil { - return nil, nil, err - } - - randomWordsFulfilledEvent, err := WaitRandomWordsFulfilledEvent( - coordinator, - randomWordsRequestedEvent.RequestId, - subID, - randomWordsRequestedEvent.Raw.BlockNumber, - isNativeBilling, - config.RandomWordsFulfilledEventTimeout.Duration, - l, - keyNum, - ) - if err != nil { - return nil, nil, err - } - return randomWordsRequestedEvent, randomWordsFulfilledEvent, nil -} - -func DeployVRFV2PlusDirectFundingContracts( - sethClient *seth.Client, - linkTokenAddress string, - linkEthFeedAddress string, - coordinator contracts.VRFCoordinatorV2_5, - numberOfConsumerContracts int, - wrapperSubId *big.Int, - configGeneral *vrfv2plusconfig.General, -) (*VRFV2PlusWrapperContracts, error) { - var vrfv2PlusWrapper contracts.VRFV2PlusWrapper - var err error - if actions.IsOPStackChain(sethClient.ChainID) { - opStackWrapper, err := contracts.DeployVRFV2PlusWrapperOptimism(sethClient, linkTokenAddress, linkEthFeedAddress, coordinator.Address(), wrapperSubId) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployWrapper, err) - } - err = opStackWrapper.SetL1FeeCalculation(*configGeneral.L1FeeCalculationMode, *configGeneral.L1FeeCoefficient) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrSetL1FeeCalculation, err) - } - vrfv2PlusWrapper, err = contracts.LoadVRFV2PlusWrapper(sethClient, opStackWrapper.Address.String()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrLoadingCoordinator, err) - } - } else if actions.IsArbitrumChain(sethClient.ChainID) { - arbitrumWrapper, err := contracts.DeployVRFV2PlusWrapperArbitrum(sethClient, linkTokenAddress, linkEthFeedAddress, coordinator.Address(), wrapperSubId) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployCoordinatorV2Plus, err) - } - vrfv2PlusWrapper, err = contracts.LoadVRFV2PlusWrapper(sethClient, arbitrumWrapper.Address.String()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrLoadingCoordinator, err) - } - } else { - vrfv2PlusWrapper, err = contracts.DeployVRFV2PlusWrapper(sethClient, linkTokenAddress, linkEthFeedAddress, coordinator.Address(), wrapperSubId) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployWrapper, err) - } - } - consumers, err := DeployVRFV2PlusWrapperConsumers(sethClient, vrfv2PlusWrapper, numberOfConsumerContracts) - if err != nil { - return nil, err - } - return &VRFV2PlusWrapperContracts{vrfv2PlusWrapper, consumers}, nil -} - -func WrapperRequestRandomness(consumer contracts.VRFv2PlusWrapperLoadTestConsumer, coordinator contracts.Coordinator, vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, config *vrfv2plusconfig.General, l zerolog.Logger) (*contracts.CoordinatorRandomWordsRequested, string, error) { - LogRandRequest( - l, - consumer.Address(), - coordinator.Address(), - subID, - isNativeBilling, - vrfKeyData.KeyHash, - config, - 0, - ) - var randomWordsRequestedEvent *contracts.CoordinatorRandomWordsRequested - var err error - if isNativeBilling { - randomWordsRequestedEvent, err = consumer.RequestRandomnessNative( - coordinator, - *config.MinimumConfirmations, - *config.CallbackGasLimit, - *config.NumberOfWords, - *config.RandomnessRequestCountPerRequest, - ) - if err != nil { - return nil, "", fmt.Errorf(vrfcommon.ErrGenericFormat, ErrRequestRandomnessDirectFundingNativePayment, err) - } - } else { - randomWordsRequestedEvent, err = consumer.RequestRandomness( - coordinator, - *config.MinimumConfirmations, - *config.CallbackGasLimit, - *config.NumberOfWords, - *config.RandomnessRequestCountPerRequest, - ) - if err != nil { - return nil, "", fmt.Errorf(vrfcommon.ErrGenericFormat, ErrRequestRandomnessDirectFundingLinkPayment, err) - } - } - vrfcommon.LogRandomnessRequestedEvent(l, coordinator, randomWordsRequestedEvent, isNativeBilling, 0) - wrapperAddress, err := consumer.GetWrapper(context.Background()) - if err != nil { - return nil, "", fmt.Errorf("error getting wrapper address, err: %w", err) - } - return randomWordsRequestedEvent, wrapperAddress.Hex(), nil -} - -func DirectFundingRequestRandomnessAndWaitForFulfillment( - consumer contracts.VRFv2PlusWrapperLoadTestConsumer, - coordinator contracts.Coordinator, - vrfKeyData *vrfcommon.VRFKeyData, - subID *big.Int, - isNativeBilling bool, - config *vrfv2plusconfig.General, - l zerolog.Logger, -) (*contracts.CoordinatorRandomWordsFulfilled, error) { - randomWordsRequestedEvent, _, err := WrapperRequestRandomness(consumer, coordinator, vrfKeyData, subID, - isNativeBilling, config, l) - if err != nil { - return nil, fmt.Errorf("error getting wrapper address, err: %w", err) - } - return WaitRandomWordsFulfilledEvent( - coordinator, - randomWordsRequestedEvent.RequestId, - subID, - randomWordsRequestedEvent.Raw.BlockNumber, - isNativeBilling, - config.RandomWordsFulfilledEventTimeout.Duration, - l, - 0, - ) -} - -func WaitRandomWordsFulfilledEvent( - coordinator contracts.Coordinator, - requestId *big.Int, - subID *big.Int, - randomWordsRequestedEventBlockNumber uint64, - isNativeBilling bool, - randomWordsFulfilledEventTimeout time.Duration, - l zerolog.Logger, - keyNum int, -) (*contracts.CoordinatorRandomWordsFulfilled, error) { - randomWordsFulfilledEvent, err := coordinator.WaitForRandomWordsFulfilledEvent( - contracts.RandomWordsFulfilledEventFilter{ - SubIDs: []*big.Int{subID}, - RequestIds: []*big.Int{requestId}, - Timeout: randomWordsFulfilledEventTimeout, - }, - ) - if err != nil { - l.Warn(). - Str("requestID", requestId.String()). - Err(err).Msg("Error waiting for random words fulfilled event, trying to filter for the event") - randomWordsFulfilledEvent, err = coordinator.FilterRandomWordsFulfilledEvent( - &bind.FilterOpts{ - Start: randomWordsRequestedEventBlockNumber, - }, - requestId, - ) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFilterRandomWordsFulfilledEvent, err) - } - } - - vrfcommon.LogRandomWordsFulfilledEvent(l, coordinator, randomWordsFulfilledEvent, isNativeBilling, keyNum) - return randomWordsFulfilledEvent, err -} - -func DeployVRFV2PlusWrapperConsumers(client *seth.Client, vrfV2PlusWrapper contracts.VRFV2PlusWrapper, numberOfConsumerContracts int) ([]contracts.VRFv2PlusWrapperLoadTestConsumer, error) { - var consumers []contracts.VRFv2PlusWrapperLoadTestConsumer - for i := 1; i <= numberOfConsumerContracts; i++ { - loadTestConsumer, err := contracts.DeployVRFV2PlusWrapperLoadTestConsumer(client, vrfV2PlusWrapper.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrAdvancedConsumer, err) - } - consumers = append(consumers, loadTestConsumer) - } - return consumers, nil -} - -func SetupVRFV2PlusContracts( - sethClient *seth.Client, - linkToken contracts.LinkToken, - mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - configGeneral *vrfv2plusconfig.General, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, error) { - l.Info().Msg("Deploying VRFV2 Plus contracts") - vrfContracts, err := DeployVRFV2_5Contracts(sethClient, configGeneral) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployVRFV2_5Contracts, err) - } - vrfContracts.LinkToken = linkToken - vrfContracts.MockETHLINKFeed = mockNativeLINKFeed - - l.Info().Str("Coordinator", vrfContracts.CoordinatorV2Plus.Address()).Msg("Setting Coordinator Config") - err = vrfContracts.CoordinatorV2Plus.SetConfig( - *configGeneral.MinimumConfirmations, - *configGeneral.MaxGasLimitCoordinatorConfig, - *configGeneral.StalenessSeconds, - *configGeneral.GasAfterPaymentCalculation, - decimal.RequireFromString(*configGeneral.FallbackWeiPerUnitLink).BigInt(), - *configGeneral.FulfillmentFlatFeeNativePPM, - *configGeneral.FulfillmentFlatFeeLinkDiscountPPM, - *configGeneral.NativePremiumPercentage, - *configGeneral.LinkPremiumPercentage, - ) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrSetVRFCoordinatorConfig, err) - } - - l.Info().Str("Coordinator", vrfContracts.CoordinatorV2Plus.Address()).Msg("Setting Link and ETH/LINK feed") - err = vrfContracts.CoordinatorV2Plus.SetLINKAndLINKNativeFeed(linkToken.Address(), mockNativeLINKFeed.Address()) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrSetLinkNativeLinkFeed, err) - } - - return vrfContracts, nil -} - -func SetupNewConsumersAndSubs( - ctx context.Context, - sethClient *seth.Client, - coordinator contracts.VRFCoordinatorV2_5, - testConfig tc.TestConfig, - linkToken contracts.LinkToken, - consumerContractsAmount int, - numberOfSubToCreate int, - l zerolog.Logger, -) ([]contracts.VRFv2PlusLoadTestConsumer, []*big.Int, error) { - consumers, err := DeployVRFV2PlusConsumers(sethClient, coordinator, consumerContractsAmount) - if err != nil { - return nil, nil, err - } - l.Info(). - Str("Coordinator", *testConfig.VRFv2Plus.ExistingEnvConfig.ExistingEnvConfig.CoordinatorAddress). - Int("Number of Subs to create", numberOfSubToCreate). - Msg("Creating and funding subscriptions, deploying and adding consumers to subs") - subIDs, err := CreateFundSubsAndAddConsumers( - ctx, - sethClient, - big.NewFloat(*testConfig.VRFv2Plus.General.SubscriptionFundingAmountNative), - big.NewFloat(*testConfig.VRFv2Plus.General.SubscriptionFundingAmountLink), - linkToken, - coordinator, - consumers, - *testConfig.VRFv2Plus.General.NumberOfSubToCreate, - *testConfig.VRFv2Plus.General.SubscriptionBillingType, - ) - if err != nil { - return nil, nil, err - } - return consumers, subIDs, nil -} - -func CancelSubsAndReturnFunds(ctx context.Context, vrfContracts *vrfcommon.VRFContracts, eoaWalletAddress string, subIDs []*big.Int, l zerolog.Logger) { - for _, subID := range subIDs { - l.Info(). - Str("Returning funds from SubID", subID.String()). - Str("Returning funds to", eoaWalletAddress). - Msg("Canceling subscription and returning funds to subscription owner") - pendingRequestsExist, err := vrfContracts.CoordinatorV2Plus.PendingRequestsExist(ctx, subID) - if err != nil { - l.Error().Err(err).Msg("Error checking if pending requests exist") - } - if !pendingRequestsExist { - _, _, err := vrfContracts.CoordinatorV2Plus.CancelSubscription(subID, common.HexToAddress(eoaWalletAddress)) - if err != nil { - l.Error().Err(err).Msg("Error canceling subscription") - } - } else { - l.Error().Str("Sub ID", subID.String()).Msg("Pending requests exist for subscription, cannot cancel subscription and return funds") - } - } -} - -func FundWrapperConsumer( - sethClient *seth.Client, - subFundingType string, - linkToken contracts.LinkToken, - wrapperConsumer contracts.VRFv2PlusWrapperLoadTestConsumer, - vrfv2PlusConfig *vrfv2plusconfig.General, - l zerolog.Logger, -) error { - fundConsumerWithLink := func() error { - // fund consumer with Link - linkAmount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(*vrfv2PlusConfig.WrapperConsumerFundingAmountLink)) - l.Info(). - Str("Link Amount", linkAmount.String()). - Str("WrapperConsumerAddress", wrapperConsumer.Address()).Msg("Funding WrapperConsumer with Link") - return linkToken.Transfer( - wrapperConsumer.Address(), - linkAmount, - ) - } - fundConsumerWithNative := func() error { - // fund consumer with Eth (native token) - _, err := actions.SendFunds(l, sethClient, actions.FundsToSendPayload{ - ToAddress: common.HexToAddress(wrapperConsumer.Address()), - Amount: conversions.EtherToWei(big.NewFloat(*vrfv2PlusConfig.WrapperConsumerFundingAmountNativeToken)), - PrivateKey: sethClient.PrivateKeys[0], - }) - return err - } - switch vrfv2plusconfig.BillingType(subFundingType) { - case vrfv2plusconfig.BillingType_Link: - err := fundConsumerWithLink() - if err != nil { - return err - } - case vrfv2plusconfig.BillingType_Native: - err := fundConsumerWithNative() - if err != nil { - return err - } - case vrfv2plusconfig.BillingType_Link_and_Native: - err := fundConsumerWithLink() - if err != nil { - return err - } - err = fundConsumerWithNative() - if err != nil { - return err - } - default: - return fmt.Errorf("invalid billing type: %s", subFundingType) - } - return nil -} diff --git a/integration-tests/actions/vrf/vrfv2plus/errors.go b/integration-tests/actions/vrf/vrfv2plus/errors.go deleted file mode 100644 index a2802032ec9..00000000000 --- a/integration-tests/actions/vrf/vrfv2plus/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -package vrfv2plus - -const ( - ErrDeployCoordinatorV2Plus = "error deploying VRF CoordinatorV2Plus" - ErrDeployBatchCoordinatorV2Plus = "error deploying Batch VRF CoordinatorV2Plus" - ErrCreatingVRFv2PlusKey = "error creating VRFv2Plus key" - ErrAdvancedConsumer = "error deploying VRFv2Plus Advanced Consumer" - ErrCreatingVRFv2PlusJob = "error creating VRFv2Plus job" - ErrDeployVRFV2_5Contracts = "error deploying VRFV2_5 contracts" - ErrAddConsumerToSub = "error adding consumer to VRF Subscription" - ErrFundSubWithNativeToken = "error funding subscription with native token" - ErrSetLinkNativeLinkFeed = "error setting Link and ETH/LINK feed for VRF Coordinator contract" - ErrCreateVRFV2PlusJobs = "error creating VRF V2 Plus Jobs" - ErrRequestRandomnessDirectFundingLinkPayment = "error requesting randomness with direct funding and link payment" - ErrRequestRandomnessDirectFundingNativePayment = "error requesting randomness with direct funding and native payment" - ErrLinkTotalBalance = "error waiting for RandomWordsFulfilled event" - ErrNativeTokenBalance = "error waiting for RandomWordsFulfilled event" - ErrDeployWrapper = "error deploying VRFV2PlusWrapper" - ErrSetL1FeeCalculation = "error setting L1 fee calculation" -) diff --git a/integration-tests/actions/vrf/vrfv2plus/logging_helpers.go b/integration-tests/actions/vrf/vrfv2plus/logging_helpers.go deleted file mode 100644 index 45173d097ee..00000000000 --- a/integration-tests/actions/vrf/vrfv2plus/logging_helpers.go +++ /dev/null @@ -1,74 +0,0 @@ -package vrfv2plus - -import ( - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_upgraded_version" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - vrfv2plus_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" -) - -func LogRandRequest( - l zerolog.Logger, - consumer string, - coordinator string, - subID *big.Int, - isNativeBilling bool, - keyHash [32]byte, - config *vrfv2plus_config.General, - keyNum int, -) { - l.Info(). - Int("KeyNum", keyNum). - Str("Consumer", consumer). - Str("Coordinator", coordinator). - Str("SubID", subID.String()). - Bool("IsNativePayment", isNativeBilling). - Uint16("MinimumConfirmations", *config.MinimumConfirmations). - Uint32("CallbackGasLimit", *config.CallbackGasLimit). - Uint32("NumberOfWords", *config.NumberOfWords). - Str("KeyHash", fmt.Sprintf("0x%x", keyHash)). - Uint16("RandomnessRequestCountPerRequest", *config.RandomnessRequestCountPerRequest). - Uint16("RandomnessRequestCountPerRequestDeviation", *config.RandomnessRequestCountPerRequestDeviation). - Msg("Requesting randomness") -} - -func LogMigrationCompletedEvent(l zerolog.Logger, migrationCompletedEvent *vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted, coordinator contracts.Coordinator) { - l.Info(). - Str("Subscription ID", migrationCompletedEvent.SubId.String()). - Str("Migrated From Coordinator", coordinator.Address()). - Str("Migrated To Coordinator", migrationCompletedEvent.NewCoordinator.String()). - Msg("MigrationCompleted Event") -} - -func LogSubDetailsAfterMigration(l zerolog.Logger, newCoordinator contracts.Coordinator, subID *big.Int, migratedSubscription vrf_v2plus_upgraded_version.GetSubscription) { - l.Info(). - Str("New Coordinator", newCoordinator.Address()). - Str("Subscription ID", subID.String()). - Str("Juels Balance", migratedSubscription.Balance.String()). - Str("Native Token Balance", migratedSubscription.NativeBalance.String()). - Str("Subscription Owner", migratedSubscription.SubOwner.String()). - Interface("Subscription Consumers", migratedSubscription.Consumers). - Msg("Subscription Data After Migration to New Coordinator") -} - -func LogPaymentDetails(l zerolog.Logger, fulfillmentTxFeeWei *big.Int, fulfillmentTxReceipt *types.Receipt, actualSubPaymentWei *big.Int, expectedSubPaymentWei *big.Float, configCopy tc.TestConfig) { - l.Info(). - Str("Tx Fee in Wei", fulfillmentTxFeeWei.String()). - Str("Effective Gas Price", fulfillmentTxReceipt.EffectiveGasPrice.String()). - Uint64("Gas Used", fulfillmentTxReceipt.GasUsed). - Str("Actual Subscription Payment in Wei", actualSubPaymentWei.String()). - Str("Expected Subscription Payment in Wei", expectedSubPaymentWei.String()). - Uint8("Native Premium Percentage", *configCopy.VRFv2Plus.General.NativePremiumPercentage). - Uint8("Link Premium Percentage", *configCopy.VRFv2Plus.General.LinkPremiumPercentage). - Uint32("FulfillmentFlatFeeNativePPM", *configCopy.VRFv2Plus.General.FulfillmentFlatFeeNativePPM). - Uint32("FulfillmentFlatFeeLinkDiscountPPM", *configCopy.VRFv2Plus.General.FulfillmentFlatFeeLinkDiscountPPM). - Uint32("GasAfterPaymentCalculation", *configCopy.VRFv2Plus.General.GasAfterPaymentCalculation). - Msg("Randomness Fulfillment Payment Details") -} diff --git a/integration-tests/actions/vrf/vrfv2plus/models.go b/integration-tests/actions/vrf/vrfv2plus/models.go deleted file mode 100644 index 5198439c050..00000000000 --- a/integration-tests/actions/vrf/vrfv2plus/models.go +++ /dev/null @@ -1,10 +0,0 @@ -package vrfv2plus - -import ( - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -type VRFV2PlusWrapperContracts struct { - VRFV2PlusWrapper contracts.VRFV2PlusWrapper - WrapperConsumers []contracts.VRFv2PlusWrapperLoadTestConsumer -} diff --git a/integration-tests/actions/vrf/vrfv2plus/setup_steps.go b/integration-tests/actions/vrf/vrfv2plus/setup_steps.go deleted file mode 100644 index 14f19562d9a..00000000000 --- a/integration-tests/actions/vrf/vrfv2plus/setup_steps.go +++ /dev/null @@ -1,656 +0,0 @@ -package vrfv2plus - -import ( - "context" - "fmt" - "math/big" - "testing" - - "github.com/shopspring/decimal" - "golang.org/x/sync/errgroup" - - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - vrfcommon "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/common" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - vrfv2plusconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" - "github.com/smartcontractkit/chainlink/integration-tests/types" - "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" - - "github.com/smartcontractkit/chainlink-evm/pkg/assets" -) - -func CreateVRFV2PlusJob( - chainlinkNode *nodeclient.ChainlinkClient, - vrfJobSpecConfig vrfcommon.VRFJobSpecConfig, -) (*nodeclient.Job, error) { - jobUUID := uuid.New() - os := &nodeclient.VRFV2PlusTxPipelineSpec{ - Address: vrfJobSpecConfig.CoordinatorAddress, - EstimateGasMultiplier: vrfJobSpecConfig.EstimateGasMultiplier, - FromAddress: vrfJobSpecConfig.FromAddresses[0], - SimulationBlock: vrfJobSpecConfig.SimulationBlock, - } - ost, err := os.String() - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrParseJob, err) - } - - jobSpec := nodeclient.VRFV2PlusJobSpec{ - Name: fmt.Sprintf("vrf-v2-plus-%s", jobUUID), - CoordinatorAddress: vrfJobSpecConfig.CoordinatorAddress, - FromAddresses: vrfJobSpecConfig.FromAddresses, - EVMChainID: vrfJobSpecConfig.EVMChainID, - MinIncomingConfirmations: vrfJobSpecConfig.MinIncomingConfirmations, - PublicKey: vrfJobSpecConfig.PublicKey, - ExternalJobID: jobUUID.String(), - ObservationSource: ost, - BatchFulfillmentEnabled: vrfJobSpecConfig.BatchFulfillmentEnabled, - BatchFulfillmentGasMultiplier: vrfJobSpecConfig.BatchFulfillmentGasMultiplier, - PollPeriod: vrfJobSpecConfig.PollPeriod, - RequestTimeout: vrfJobSpecConfig.RequestTimeout, - } - - if vrfJobSpecConfig.BatchFulfillmentEnabled { - jobSpec.BatchCoordinatorAddress = vrfJobSpecConfig.BatchCoordinatorAddress - } - job, err := chainlinkNode.MustCreateJob(&jobSpec) - if err != nil { - return nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrCreatingVRFv2PlusJob, err) - } - return job, nil -} - -// SetupVRFV2_5Environment will create specified number of subscriptions and add the same conumer/s to each of them -func SetupVRFV2_5Environment( - ctx context.Context, - sethClient *seth.Client, - env *test_env.CLClusterTestEnv, - chainID int64, - nodesToCreate []vrfcommon.VRFNodeType, - vrfv2PlusTestConfig types.VRFv2PlusTestConfig, - linkToken contracts.LinkToken, - mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - numberOfTxKeysToCreate int, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, error) { - l.Info().Msg("Starting VRFV2 Plus environment setup") - configGeneral := vrfv2PlusTestConfig.GetVRFv2PlusConfig().General - vrfContracts, err := SetupVRFV2PlusContracts( - sethClient, - linkToken, - mockNativeLINKFeed, - configGeneral, - l, - ) - if err != nil { - return nil, nil, nil, err - } - - nodeTypeToNodeMap, err := vrfcommon.CreateNodeTypeToNodeMap(env.ClCluster, nodesToCreate) - if err != nil { - return nil, nil, nil, err - } - vrfKey, pubKeyCompressed, err := vrfcommon.CreateVRFKeyOnVRFNode(nodeTypeToNodeMap[vrfcommon.VRF], l) - if err != nil { - return nil, nil, nil, err - } - l.Info().Str("Coordinator", vrfContracts.CoordinatorV2Plus.Address()).Msg("Registering Proving Key") - provingKey, err := VRFV2_5RegisterProvingKey(vrfKey, vrfContracts.CoordinatorV2Plus, assets.GWei(*configGeneral.CLNodeMaxGasPriceGWei).ToInt().Uint64()) - if err != nil { - return nil, nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRegisteringProvingKey, err) - } - keyHash, err := vrfContracts.CoordinatorV2Plus.HashOfKey(ctx, provingKey) - if err != nil { - return nil, nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrCreatingProvingKeyHash, err) - } - - vrfTXKeyAddressStrings, _, err := vrfcommon.CreateFundAndGetSendingKeys( - l, - sethClient, - nodeTypeToNodeMap[vrfcommon.VRF], - *vrfv2PlusTestConfig.GetCommonConfig().ChainlinkNodeFunding, - numberOfTxKeysToCreate, - big.NewInt(chainID), - ) - if err != nil { - return nil, nil, nil, err - } - - nodeTypeToNodeMap[vrfcommon.VRF].TXKeyAddressStrings = vrfTXKeyAddressStrings - - g := errgroup.Group{} - if vrfNode, exists := nodeTypeToNodeMap[vrfcommon.VRF]; exists { - g.Go(func() error { - err := setupVRFNode(vrfContracts, big.NewInt(chainID), configGeneral, pubKeyCompressed, l, vrfNode) - if err != nil { - return err - } - return nil - }) - } - - if bhsNode, exists := nodeTypeToNodeMap[vrfcommon.BHS]; exists { - g.Go(func() error { - err := vrfcommon.SetupBHSNode( - sethClient, - configGeneral.General, - numberOfTxKeysToCreate, - big.NewInt(chainID), - vrfContracts.CoordinatorV2Plus.Address(), - vrfContracts.BHS.Address(), - *vrfv2PlusTestConfig.GetCommonConfig().ChainlinkNodeFunding, - l, - bhsNode, - ) - if err != nil { - return err - } - return nil - }) - } - - if bhfNode, exists := nodeTypeToNodeMap[vrfcommon.BHF]; exists { - g.Go(func() error { - err := vrfcommon.SetupBHFNode( - sethClient, - configGeneral.General, - numberOfTxKeysToCreate, - big.NewInt(chainID), - vrfContracts.CoordinatorV2Plus.Address(), - vrfContracts.BHS.Address(), - vrfContracts.BatchBHS.Address(), - *vrfv2PlusTestConfig.GetCommonConfig().ChainlinkNodeFunding, - l, - bhfNode, - ) - if err != nil { - return err - } - return nil - }) - } - - if err := g.Wait(); err != nil { - return nil, nil, nil, fmt.Errorf("VRF node setup ended up with an error: %w", err) - } - - vrfKeyData := vrfcommon.VRFKeyData{ - VRFKey: vrfKey, - EncodedProvingKey: provingKey, - KeyHash: keyHash, - PubKeyCompressed: pubKeyCompressed, - } - - l.Info().Msg("VRFV2 Plus environment setup is finished") - return vrfContracts, &vrfKeyData, nodeTypeToNodeMap, nil -} - -func setupVRFNode(contracts *vrfcommon.VRFContracts, chainID *big.Int, config *vrfv2plusconfig.General, pubKeyCompressed string, l zerolog.Logger, vrfNode *vrfcommon.VRFNode) error { - vrfJobSpecConfig := vrfcommon.VRFJobSpecConfig{ - ForwardingAllowed: *config.VRFJobForwardingAllowed, - CoordinatorAddress: contracts.CoordinatorV2Plus.Address(), - BatchCoordinatorAddress: contracts.BatchCoordinatorV2Plus.Address(), - FromAddresses: vrfNode.TXKeyAddressStrings, - EVMChainID: chainID.String(), - MinIncomingConfirmations: int(*config.MinimumConfirmations), - PublicKey: pubKeyCompressed, - EstimateGasMultiplier: *config.VRFJobEstimateGasMultiplier, - BatchFulfillmentEnabled: *config.VRFJobBatchFulfillmentEnabled, - BatchFulfillmentGasMultiplier: *config.VRFJobBatchFulfillmentGasMultiplier, - PollPeriod: config.VRFJobPollPeriod.Duration, - RequestTimeout: config.VRFJobRequestTimeout.Duration, - SimulationBlock: config.VRFJobSimulationBlock, - VRFOwnerConfig: nil, - } - - l.Info().Msg("Creating VRFV2 Plus Job") - job, err := CreateVRFV2PlusJob( - vrfNode.CLNode.API, - vrfJobSpecConfig, - ) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrCreateVRFV2PlusJobs, err) - } - vrfNode.Job = job - - // this part is here because VRFv2 can work with only a specific key - // [[EVM.KeySpecific]] - // Key = '...' - nodeConfig := node.NewConfig(vrfNode.CLNode.NodeConfig, - node.WithKeySpecificMaxGasPrice(vrfNode.TXKeyAddressStrings, *config.CLNodeMaxGasPriceGWei), - ) - l.Info(). - Strs("Sending Keys", vrfNode.TXKeyAddressStrings). - Int64("Price Max Setting", *config.CLNodeMaxGasPriceGWei). - Msg("Restarting Node with new sending key PriceMax configuration") - err = vrfNode.CLNode.Restart(nodeConfig) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrRestartCLNode, err) - } - return nil -} - -func SetupVRFV2PlusWrapperForExistingEnv( - ctx context.Context, - sethClient *seth.Client, - vrfContracts *vrfcommon.VRFContracts, - keyHash [32]byte, - vrfv2PlusTestConfig types.VRFv2PlusTestConfig, - numberOfConsumerContracts int, - l zerolog.Logger, -) (*VRFV2PlusWrapperContracts, *big.Int, error) { - config := *vrfv2PlusTestConfig.GetVRFv2PlusConfig() - var wrapper contracts.VRFV2PlusWrapper - var err error - if *config.ExistingEnvConfig.UseExistingWrapper { - wrapper, err = contracts.LoadVRFV2PlusWrapper(sethClient, *config.ExistingEnvConfig.WrapperAddress) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, "error loading VRFV2PlusWrapper", err) - } - } else { - wrapperSubId, err := CreateSubAndFindSubID(ctx, sethClient, vrfContracts.CoordinatorV2Plus) - if err != nil { - return nil, nil, err - } - wrapper, err = contracts.DeployVRFV2PlusWrapper(sethClient, vrfContracts.LinkToken.Address(), vrfContracts.LinkNativeFeedAddress, vrfContracts.CoordinatorV2Plus.Address(), wrapperSubId) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, ErrDeployWrapper, err) - } - err = FundSubscriptions( - big.NewFloat(*config.General.SubscriptionFundingAmountNative), - big.NewFloat(*config.General.SubscriptionFundingAmountLink), - vrfContracts.LinkToken, - vrfContracts.CoordinatorV2Plus, - []*big.Int{wrapperSubId}, - *config.General.SubscriptionBillingType, - ) - if err != nil { - return nil, nil, err - } - err = vrfContracts.CoordinatorV2Plus.AddConsumer(wrapperSubId, wrapper.Address()) - if err != nil { - return nil, nil, err - } - err = wrapper.SetConfig( - *config.General.WrapperGasOverhead, - *config.General.CoordinatorGasOverheadNative, - *config.General.CoordinatorGasOverheadLink, - *config.General.CoordinatorGasOverheadPerWord, - *config.General.CoordinatorNativePremiumPercentage, - *config.General.CoordinatorLinkPremiumPercentage, - keyHash, - *config.General.WrapperMaxNumberOfWords, - *config.General.StalenessSeconds, - decimal.RequireFromString(*config.General.FallbackWeiPerUnitLink).BigInt(), - *config.General.FulfillmentFlatFeeNativePPM, - *config.General.FulfillmentFlatFeeLinkDiscountPPM, - ) - if err != nil { - return nil, nil, err - } - } - wrapperSubID, err := wrapper.GetSubID(ctx) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, "error getting subID", err) - } - var wrapperConsumers []contracts.VRFv2PlusWrapperLoadTestConsumer - if *config.ExistingEnvConfig.CreateFundAddWrapperConsumers { - wrapperConsumers, err = DeployVRFV2PlusWrapperConsumers(sethClient, wrapper, numberOfConsumerContracts) - if err != nil { - return nil, nil, err - } - } else { - wrapperConsumer, err := contracts.LoadVRFV2WrapperLoadTestConsumer(sethClient, *config.ExistingEnvConfig.WrapperConsumerAddress) - if err != nil { - return nil, nil, fmt.Errorf(vrfcommon.ErrGenericFormat, "error loading VRFV2WrapperLoadTestConsumer", err) - } - wrapperConsumers = append(wrapperConsumers, wrapperConsumer) - } - wrapperContracts := &VRFV2PlusWrapperContracts{wrapper, wrapperConsumers} - for _, consumer := range wrapperConsumers { - err = FundWrapperConsumer( - sethClient, - *config.General.SubscriptionBillingType, - vrfContracts.LinkToken, - consumer, - config.General, - l, - ) - if err != nil { - return nil, nil, err - } - } - return wrapperContracts, wrapperSubID, nil -} - -func SetupVRFV2PlusWrapperForNewEnv( - ctx context.Context, - sethClient *seth.Client, - vrfv2PlusTestConfig types.VRFv2PlusTestConfig, - vrfContracts *vrfcommon.VRFContracts, - keyHash [32]byte, - wrapperConsumerContractsAmount int, - l zerolog.Logger, -) (*VRFV2PlusWrapperContracts, *big.Int, error) { - // external EOA has to create a subscription for the wrapper first - wrapperSubId, err := CreateSubAndFindSubID(ctx, sethClient, vrfContracts.CoordinatorV2Plus) - if err != nil { - return nil, nil, err - } - vrfv2PlusConfig := vrfv2PlusTestConfig.GetVRFv2PlusConfig().General - wrapperContracts, err := DeployVRFV2PlusDirectFundingContracts( - sethClient, - vrfContracts.LinkToken.Address(), - vrfContracts.MockETHLINKFeed.Address(), - vrfContracts.CoordinatorV2Plus, - wrapperConsumerContractsAmount, - wrapperSubId, - vrfv2PlusConfig, - ) - if err != nil { - return nil, nil, err - } - // once the wrapper is deployed, wrapper address will become consumer of external EOA subscription - err = vrfContracts.CoordinatorV2Plus.AddConsumer(wrapperSubId, wrapperContracts.VRFV2PlusWrapper.Address()) - if err != nil { - return nil, nil, err - } - err = wrapperContracts.VRFV2PlusWrapper.SetConfig( - *vrfv2PlusConfig.WrapperGasOverhead, - *vrfv2PlusConfig.CoordinatorGasOverheadNative, - *vrfv2PlusConfig.CoordinatorGasOverheadLink, - *vrfv2PlusConfig.CoordinatorGasOverheadPerWord, - *vrfv2PlusConfig.CoordinatorNativePremiumPercentage, - *vrfv2PlusConfig.CoordinatorLinkPremiumPercentage, - keyHash, - *vrfv2PlusConfig.WrapperMaxNumberOfWords, - *vrfv2PlusConfig.StalenessSeconds, - decimal.RequireFromString(*vrfv2PlusConfig.FallbackWeiPerUnitLink).BigInt(), - *vrfv2PlusConfig.FulfillmentFlatFeeNativePPM, - *vrfv2PlusConfig.FulfillmentFlatFeeLinkDiscountPPM, - ) - if err != nil { - return nil, nil, err - } - // fund sub - wrapperSubID, err := wrapperContracts.VRFV2PlusWrapper.GetSubID(ctx) - if err != nil { - return nil, nil, err - } - err = FundSubscriptions( - big.NewFloat(*vrfv2PlusTestConfig.GetVRFv2PlusConfig().General.SubscriptionFundingAmountNative), - big.NewFloat(*vrfv2PlusTestConfig.GetVRFv2PlusConfig().General.SubscriptionFundingAmountLink), - vrfContracts.LinkToken, - vrfContracts.CoordinatorV2Plus, - []*big.Int{wrapperSubID}, - *vrfv2PlusConfig.SubscriptionBillingType, - ) - if err != nil { - return nil, nil, err - } - for _, consumer := range wrapperContracts.WrapperConsumers { - err = FundWrapperConsumer( - sethClient, - *vrfv2PlusConfig.SubscriptionBillingType, - vrfContracts.LinkToken, - consumer, - vrfv2PlusConfig, - l, - ) - if err != nil { - return nil, nil, err - } - } - return wrapperContracts, wrapperSubID, nil -} - -func SetupVRFV2PlusUniverse( - ctx context.Context, - t *testing.T, - envConfig vrfcommon.VRFEnvConfig, - newEnvConfig vrfcommon.NewEnvConfig, - l zerolog.Logger, -) (*test_env.CLClusterTestEnv, *vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, *seth.Client, error) { - var ( - env *test_env.CLClusterTestEnv - vrfContracts *vrfcommon.VRFContracts - vrfKey *vrfcommon.VRFKeyData - nodeTypeToNode map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode - sethClient *seth.Client - err error - ) - if *envConfig.TestConfig.VRFv2Plus.General.UseExistingEnv { - vrfContracts, vrfKey, env, sethClient, err = SetupVRFV2PlusForExistingEnv(t, envConfig, l) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error setting up VRF V2 Plus for Existing env", err) - } - } else { - vrfContracts, vrfKey, env, nodeTypeToNode, sethClient, err = SetupVRFV2PlusForNewEnv(ctx, t, envConfig, newEnvConfig, l) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error setting up VRF V2 Plus for New env", err) - } - } - - return env, vrfContracts, vrfKey, nodeTypeToNode, sethClient, nil -} - -func SetupVRFV2PlusForNewEnv( - ctx context.Context, - t *testing.T, - envConfig vrfcommon.VRFEnvConfig, - newEnvConfig vrfcommon.NewEnvConfig, - l zerolog.Logger, -) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, *test_env.CLClusterTestEnv, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, *seth.Client, error) { - network, err := actions.EthereumNetworkConfigFromConfig(l, &envConfig.TestConfig) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "Error building ethereum network config for V2Plus", err) - } - env, sethClient, err := vrfcommon.BuildNewCLEnvForVRF(l, t, envConfig, newEnvConfig, network) - if err != nil { - return nil, nil, nil, nil, nil, err - } - mockETHLinkFeed, err := contracts.DeployVRFMockETHLINKFeed(sethClient, big.NewInt(*envConfig.TestConfig.VRFv2Plus.General.LinkNativeFeedResponse)) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error deploying mock ETH/LINK feed", err) - } - linkToken, err := contracts.DeployLinkTokenContract(l, sethClient) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error deploying LINK contract", err) - } - vrfContracts, vrfKey, nodeTypeToNode, err := SetupVRFV2_5Environment( - ctx, - sethClient, - env, - envConfig.ChainID, - newEnvConfig.NodesToCreate, - &envConfig.TestConfig, - linkToken, - mockETHLinkFeed, - newEnvConfig.NumberOfTxKeysToCreate, - l, - ) - if err != nil { - return nil, nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error setting up VRF v2_5 env", err) - } - - return vrfContracts, vrfKey, env, nodeTypeToNode, sethClient, nil -} - -func SetupVRFV2PlusForExistingEnv(t *testing.T, envConfig vrfcommon.VRFEnvConfig, l zerolog.Logger) (*vrfcommon.VRFContracts, *vrfcommon.VRFKeyData, *test_env.CLClusterTestEnv, *seth.Client, error) { - commonExistingEnvConfig := envConfig.TestConfig.VRFv2Plus.ExistingEnvConfig.ExistingEnvConfig - env, sethClient, err := vrfcommon.LoadExistingCLEnvForVRF( - t, - envConfig, - commonExistingEnvConfig, - l, - ) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading existing CL env", err) - } - coordinator, err := contracts.LoadVRFCoordinatorV2_5(sethClient, *commonExistingEnvConfig.CoordinatorAddress) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading VRFCoordinator2_5", err) - } - linkAddress, err := coordinator.GetLinkAddress(testcontext.Get(t)) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error getting Link address from Coordinator", err) - } - linkToken, err := contracts.LoadLinkTokenContract(l, sethClient, common.HexToAddress(linkAddress.String())) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading LinkToken", err) - } - linkNativeFeedAddress, err := coordinator.GetLinkNativeFeed(testcontext.Get(t)) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error getting Link address from Coordinator", err) - } - blockHashStoreAddress, err := coordinator.GetBlockHashStoreAddress(testcontext.Get(t)) - if err != nil { - return nil, nil, nil, nil, err - } - blockHashStore, err := contracts.LoadBlockHashStore(sethClient, blockHashStoreAddress.String()) - if err != nil { - return nil, nil, nil, nil, fmt.Errorf("%s, err: %w", "error loading BlockHashStore", err) - } - vrfContracts := &vrfcommon.VRFContracts{ - CoordinatorV2Plus: coordinator, - VRFV2PlusConsumer: nil, - LinkToken: linkToken, - BHS: blockHashStore, - LinkNativeFeedAddress: linkNativeFeedAddress.String(), - } - vrfKey := &vrfcommon.VRFKeyData{ - VRFKey: nil, - EncodedProvingKey: [2]*big.Int{}, - KeyHash: common.HexToHash(*commonExistingEnvConfig.KeyHash), - } - return vrfContracts, vrfKey, env, sethClient, nil -} - -func SetupSubsAndConsumersForExistingEnv( - ctx context.Context, - sethClient *seth.Client, - coordinator contracts.VRFCoordinatorV2_5, - linkToken contracts.LinkToken, - numberOfConsumerContractsToDeployAndAddToSub int, - numberOfSubToCreate int, - testConfig tc.TestConfig, - l zerolog.Logger, -) ([]*big.Int, []contracts.VRFv2PlusLoadTestConsumer, error) { - var ( - subIDs []*big.Int - consumers []contracts.VRFv2PlusLoadTestConsumer - err error - ) - if *testConfig.VRFv2Plus.General.UseExistingEnv { - commonExistingEnvConfig := testConfig.VRFv2Plus.ExistingEnvConfig.ExistingEnvConfig - if *commonExistingEnvConfig.CreateFundSubsAndAddConsumers { - consumers, subIDs, err = SetupNewConsumersAndSubs( - ctx, - sethClient, - coordinator, - testConfig, - linkToken, - numberOfConsumerContractsToDeployAndAddToSub, - numberOfSubToCreate, - l, - ) - if err != nil { - return nil, nil, err - } - } else { - consumer, err := contracts.LoadVRFv2PlusLoadTestConsumer(sethClient, *commonExistingEnvConfig.ConsumerAddress) - if err != nil { - return nil, nil, err - } - consumers = append(consumers, consumer) - var ok bool - subID, ok := new(big.Int).SetString(*testConfig.VRFv2Plus.ExistingEnvConfig.SubID, 10) - if !ok { - return nil, nil, fmt.Errorf("unable to parse subID: %s %w", *testConfig.VRFv2Plus.ExistingEnvConfig.SubID, err) - } - subIDs = append(subIDs, subID) - } - } else { - consumers, subIDs, err = SetupNewConsumersAndSubs( - ctx, - sethClient, - coordinator, - testConfig, - linkToken, - numberOfConsumerContractsToDeployAndAddToSub, - numberOfSubToCreate, - l, - ) - if err != nil { - return nil, nil, err - } - } - return subIDs, consumers, nil -} - -func SelectBillingTypeWithDistribution(billingType string, distributionFn func() bool) (bool, error) { - switch vrfv2plusconfig.BillingType(billingType) { - case vrfv2plusconfig.BillingType_Link: - return false, nil - case vrfv2plusconfig.BillingType_Native: - return true, nil - case vrfv2plusconfig.BillingType_Link_and_Native: - return distributionFn(), nil - default: - return false, fmt.Errorf("invalid billing type: %s", billingType) - } -} - -func SetupVRFV2PlusWrapperUniverse( - ctx context.Context, - sethClient *seth.Client, - vrfContracts *vrfcommon.VRFContracts, - config *tc.TestConfig, - keyHash [32]byte, - numberOfConsumerContracts int, - l zerolog.Logger, -) (*VRFV2PlusWrapperContracts, *big.Int, error) { - var ( - wrapperContracts *VRFV2PlusWrapperContracts - wrapperSubID *big.Int - err error - ) - if *config.VRFv2Plus.General.UseExistingEnv { - wrapperContracts, wrapperSubID, err = SetupVRFV2PlusWrapperForExistingEnv( - ctx, - sethClient, - vrfContracts, - keyHash, - config, - numberOfConsumerContracts, - l, - ) - if err != nil { - return nil, nil, err - } - } else { - wrapperContracts, wrapperSubID, err = SetupVRFV2PlusWrapperForNewEnv( - ctx, - sethClient, - config, - vrfContracts, - keyHash, - numberOfConsumerContracts, - l, - ) - if err != nil { - return nil, nil, err - } - } - return wrapperContracts, wrapperSubID, nil -} diff --git a/integration-tests/benchmark/automation_test.go b/integration-tests/benchmark/automation_test.go deleted file mode 100644 index 59c69350205..00000000000 --- a/integration-tests/benchmark/automation_test.go +++ /dev/null @@ -1,393 +0,0 @@ -package benchmark - -import ( - "fmt" - "math/big" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - envclient "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/client" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/chainlink" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/ethereum" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/reorg" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" - sethutils "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/seth" - - "github.com/smartcontractkit/chainlink/integration-tests/actions" - ethcontracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - "github.com/smartcontractkit/chainlink/integration-tests/testsetups" - "github.com/smartcontractkit/chainlink/integration-tests/types" -) - -var ( - chainlinkResources = map[string]any{ - "resources": map[string]any{ - "requests": map[string]any{ - "cpu": "1000m", - "memory": "4Gi", - }, - "limits": map[string]any{ - "cpu": "1000m", - "memory": "4Gi", - }, - }, - } - dbResources = map[string]any{ - "resources": map[string]any{ - "requests": map[string]any{ - "cpu": "1000m", - "memory": "1Gi", - }, - "limits": map[string]any{ - "cpu": "1000m", - "memory": "1Gi", - }, - }, - "stateful": true, - "capacity": "10Gi", - } -) - -type NetworkConfig struct { - upkeepSLA int64 - blockTime time.Duration - deltaStage time.Duration - funding *big.Float -} - -var defaultNetworkConfig = NetworkConfig{ - upkeepSLA: int64(120), - blockTime: time.Second, - deltaStage: time.Duration(0), -} - -func TestAutomationBenchmark(t *testing.T) { - l := logging.GetTestLogger(t) - testType, err := tc.GetConfigurationNameFromEnv() - require.NoError(t, err, "Error getting test type") - - config, err := tc.GetConfig([]string{testType}, tc.Automation) - require.NoError(t, err, "Error getting test config") - - testEnvironment, benchmarkNetwork := SetupAutomationBenchmarkEnv(t, testType, &config) - if testEnvironment.WillUseRemoteRunner() { - return - } - networkName := strings.ReplaceAll(benchmarkNetwork.Name, " ", "") - testName := fmt.Sprintf("%s%s", networkName, *config.Automation.Benchmark.RegistryToTest) - l.Info().Str("Test Name", testName).Msg("Running Benchmark Test") - benchmarkTestNetwork := getNetworkConfig(&config) - - l.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") - testNetwork := sethutils.MustReplaceSimulatedNetworkUrlWithK8(l, benchmarkNetwork, *testEnvironment) - - chainClient, err := sethutils.GetChainClientWithConfigFunction(&config, testNetwork, sethutils.OneEphemeralKeysLiveTestnetAutoFixFn) - require.NoError(t, err, "Error getting Seth client") - - registryVersions := addRegistry(&config) - registrySettings := actions.ReadRegistryConfig(config) - keeperBenchmarkTest := testsetups.NewKeeperBenchmarkTest(t, - testsetups.KeeperBenchmarkTestInputs{ - BlockchainClient: chainClient, - RegistryVersions: registryVersions, - KeeperRegistrySettings: ®istrySettings, - Upkeeps: &testsetups.UpkeepConfig{ - NumberOfUpkeeps: *config.Automation.Benchmark.NumberOfUpkeeps, - CheckGasToBurn: *config.Automation.Benchmark.CheckGasToBurn, - PerformGasToBurn: *config.Automation.Benchmark.PerformGasToBurn, - BlockRange: *config.Automation.Benchmark.BlockRange, - BlockInterval: *config.Automation.Benchmark.BlockInterval, - UpkeepGasLimit: *config.Automation.Benchmark.UpkeepGasLimit, - FirstEligibleBuffer: 1, - }, - ChainlinkNodeFunding: benchmarkTestNetwork.funding, - UpkeepSLA: benchmarkTestNetwork.upkeepSLA, - BlockTime: benchmarkTestNetwork.blockTime, - DeltaStage: benchmarkTestNetwork.deltaStage, - ForceSingleTxnKey: *config.Automation.Benchmark.ForceSingleTxKey, - DeleteJobsOnEnd: *config.Automation.Benchmark.DeleteJobsOnEnd, - }, - ) - t.Cleanup(func() { - if err = actions.TeardownRemoteSuite(keeperBenchmarkTest.TearDownVals(t)); err != nil { - l.Error().Err(err).Msg("Error when tearing down remote suite") - } else { - if *config.GetAutomationConfig().Benchmark.DeleteJobsOnEnd { - err := testEnvironment.Client.RemoveNamespace(testEnvironment.Cfg.Namespace) - if err != nil { - l.Error().Err(err).Msg("Error removing namespace") - } - } - } - }) - keeperBenchmarkTest.Setup(testEnvironment, config) - keeperBenchmarkTest.Run() -} - -func addRegistry(config *tc.TestConfig) []ethcontracts.KeeperRegistryVersion { - switch *config.Automation.Benchmark.RegistryToTest { - case "2_0": - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_0} - case "2_1": - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_1} - case "2_2": - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_2} - case "2_3": - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_3} - case "2_2-2_1": - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_2, ethcontracts.RegistryVersion_2_1} - case "2_0-Multiple": - return repeatRegistries(ethcontracts.RegistryVersion_2_0, *config.Automation.Benchmark.NumberOfRegistries) - case "2_1-Multiple": - return repeatRegistries(ethcontracts.RegistryVersion_2_1, *config.Automation.Benchmark.NumberOfRegistries) - case "2_2-Multiple": - return repeatRegistries(ethcontracts.RegistryVersion_2_2, *config.Automation.Benchmark.NumberOfRegistries) - default: - return []ethcontracts.KeeperRegistryVersion{ethcontracts.RegistryVersion_2_0} - } -} - -func repeatRegistries(registryVersion ethcontracts.KeeperRegistryVersion, numberOfRegistries int) []ethcontracts.KeeperRegistryVersion { - repeatedRegistries := make([]ethcontracts.KeeperRegistryVersion, 0) - for range numberOfRegistries { - repeatedRegistries = append(repeatedRegistries, registryVersion) - } - return repeatedRegistries -} - -func getNetworkConfig(config *tc.TestConfig) NetworkConfig { - evmNetwork := networks.MustGetSelectedNetworkConfig(config.GetNetworkConfig())[0] - var nc NetworkConfig - var ok bool - if nc, ok = networkConfig[evmNetwork.Name]; !ok { - nc = defaultNetworkConfig - } - - if evmNetwork.Name == networks.SimulatedEVM.Name || evmNetwork.Name == networks.SimulatedEVMNonDev.Name { - return nc - } - - nc.funding = big.NewFloat(*config.Common.ChainlinkNodeFunding) - - return nc -} - -var networkConfig = map[string]NetworkConfig{ - networks.SimulatedEVM.Name: { - upkeepSLA: int64(120), // 2 minutes - blockTime: time.Second, - deltaStage: 30 * time.Second, - funding: big.NewFloat(100_000), - }, - networks.SimulatedEVMNonDev.Name: { - upkeepSLA: int64(120), // 2 minutes - blockTime: time.Second, - deltaStage: 30 * time.Second, - funding: big.NewFloat(100_000), - }, - networks.GoerliTestnet.Name: { - upkeepSLA: int64(4), - blockTime: 12 * time.Second, - deltaStage: time.Duration(0), - }, - networks.SepoliaTestnet.Name: { - upkeepSLA: int64(4), - blockTime: 12 * time.Second, - deltaStage: time.Duration(0), - }, - networks.PolygonMumbai.Name: { - upkeepSLA: int64(4), - blockTime: 12 * time.Second, - deltaStage: time.Duration(0), - }, - networks.BaseSepolia.Name: { - upkeepSLA: int64(60), - blockTime: 2 * time.Second, - deltaStage: 20 * time.Second, - }, - networks.ArbitrumSepolia.Name: { - upkeepSLA: int64(120), - blockTime: time.Second, - deltaStage: 20 * time.Second, - }, - networks.OptimismSepolia.Name: { - upkeepSLA: int64(120), - blockTime: time.Second, - deltaStage: 20 * time.Second, - }, - networks.LineaGoerli.Name: { - upkeepSLA: int64(120), - blockTime: time.Second, - deltaStage: 20 * time.Second, - }, - networks.GnosisChiado.Name: { - upkeepSLA: int64(120), - blockTime: 6 * time.Second, - deltaStage: 20 * time.Second, - }, - networks.PolygonZkEvmCardona.Name: { - upkeepSLA: int64(120), - blockTime: time.Second, - deltaStage: 20 * time.Second, - }, - networks.ScrollSepolia.Name: { - upkeepSLA: int64(120), - blockTime: 3 * time.Second, - deltaStage: 20 * time.Second, - }, -} - -func SetupAutomationBenchmarkEnv(t *testing.T, testType string, keeperTestConfig types.AutomationBenchmarkTestConfig) (*environment.Environment, blockchain.EVMNetwork) { - l := logging.GetTestLogger(t) - testNetwork := networks.MustGetSelectedNetworkConfig(keeperTestConfig.GetNetworkConfig())[0] // Environment currently being used to run benchmark test on - blockTime := "1" - numberOfNodes := *keeperTestConfig.GetAutomationConfig().General.NumberOfNodes - - if strings.Contains(*keeperTestConfig.GetAutomationConfig().Benchmark.RegistryToTest, "2_") { - numberOfNodes++ - } - - networkName := strings.ReplaceAll(testNetwork.Name, " ", "-") - networkName = strings.ReplaceAll(networkName, "_", "-") - testNetwork.Name = networkName - - nsLabels, err := environment.GetRequiredChainLinkNamespaceLabels(string(tc.Keeper), testType) - require.NoError(t, err, "Error creating required chain.link labels for namespace") - - workloadPodLabels, err := environment.GetRequiredChainLinkWorkloadAndPodLabels(string(tc.Keeper), testType) - require.NoError(t, err, "Error creating required chain.link labels for workloads and pods") - - testEnvironment := environment.New(&environment.Config{ - TTL: time.Hour * 720, // 30 days, - NamespacePrefix: fmt.Sprintf( - "automation-%s-%s-%s", - strings.ToLower(strings.Join(keeperTestConfig.GetConfigurationNames(), "")), - strings.ReplaceAll(strings.ToLower(testNetwork.Name), " ", "-"), - strings.ReplaceAll(strings.ToLower(*keeperTestConfig.GetAutomationConfig().Benchmark.RegistryToTest), "_", "-"), - ), - Test: t, - PreventPodEviction: true, - Labels: nsLabels, - WorkloadLabels: workloadPodLabels, - PodLabels: workloadPodLabels, - }) - - dbResources := dbResources - chainlinkResources := chainlinkResources - - // Test can run on simulated, simulated-non-dev, testnets - if testNetwork.Name == networks.SimulatedEVMNonDev.Name { - testEnvironment. - AddHelm(reorg.New(&reorg.Props{ - NetworkName: testNetwork.Name, - Values: map[string]any{ - "geth": map[string]any{ - "tx": map[string]any{ - "replicas": numberOfNodes, - }, - "miner": map[string]any{ - "replicas": 2, - }, - }, - }, - })) - } else { - testEnvironment. - AddHelm(ethereum.New(ðereum.Props{ - NetworkName: testNetwork.Name, - Simulated: testNetwork.Simulated, - WsURLs: testNetwork.URLs, - Values: map[string]any{ - "resources": map[string]any{ - "requests": map[string]any{ - "cpu": "4000m", - "memory": "4Gi", - }, - "limits": map[string]any{ - "cpu": "4000m", - "memory": "4Gi", - }, - }, - "geth": map[string]any{ - "blocktime": blockTime, - "capacity": "20Gi", - "startGaslimit": "20000000", - "targetGasLimit": "30000000", - }, - }, - })) - } - if testNetwork.Simulated { - // TODO we need to update the image in CTF, the old one is not available anymore - // deploy blockscout if running on simulated - // testEnvironment. - // AddChart(blockscout.New(&blockscout.Props{ - // Name: "geth-blockscout", - // WsURL: testNetwork.URLs[0], - // HttpURL: testNetwork.HTTPURLs[0]})) - // Need to setup geth node before setting up chainlink nodes - err = testEnvironment.Run() - require.NoError(t, err, "Error launching test environment") - } - - if testEnvironment.WillUseRemoteRunner() { - return testEnvironment, testNetwork - } - - // separate RPC urls per CL node - internalWsURLs := make([]string, 0) - internalHttpURLs := make([]string, 0) - for i := 0; i < numberOfNodes; i++ { - // for simulated-nod-dev each CL node gets its own RPC node - if testNetwork.Name == networks.SimulatedEVMNonDev.Name { - podName := fmt.Sprintf("%s-ethereum-geth:%d", testNetwork.Name, i) - txNodeInternalWs, err := testEnvironment.Fwd.FindPort(podName, "geth", "ws-rpc").As(envclient.RemoteConnection, envclient.WS) - require.NoError(t, err, "Error finding WS ports") - internalWsURLs = append(internalWsURLs, txNodeInternalWs) - txNodeInternalHttp, err := testEnvironment.Fwd.FindPort(podName, "geth", "http-rpc").As(envclient.RemoteConnection, envclient.HTTP) - require.NoError(t, err, "Error finding HTTP ports") - internalHttpURLs = append(internalHttpURLs, txNodeInternalHttp) - // for testnets with more than 1 RPC nodes - } else if len(testNetwork.URLs) > 1 { - internalWsURLs = append(internalWsURLs, testNetwork.URLs[i%len(testNetwork.URLs)]) - internalHttpURLs = append(internalHttpURLs, testNetwork.HTTPURLs[i%len(testNetwork.URLs)]) - // for simulated and testnets with 1 RPC node - } else { - internalWsURLs = append(internalWsURLs, testNetwork.URLs[0]) - internalHttpURLs = append(internalHttpURLs, testNetwork.HTTPURLs[0]) - } - } - l.Debug().Strs("internalWsURLs", internalWsURLs).Strs("internalHttpURLs", internalHttpURLs).Msg("internalURLs") - - for i := 0; i < numberOfNodes; i++ { - testNetwork.HTTPURLs = []string{internalHttpURLs[i]} - testNetwork.URLs = []string{internalWsURLs[i]} - - var overrideFn = func(_ any, target any) { - ctfconfig.MustConfigOverrideChainlinkVersion(keeperTestConfig.GetChainlinkImageConfig(), target) - ctfconfig.MightConfigOverridePyroscopeKey(keeperTestConfig.GetPyroscopeConfig(), target) - } - - tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(keeperTestConfig, testNetwork) - require.NoError(t, err, "Error building TOML config") - - cd := chainlink.NewWithOverride(i, map[string]any{ - "toml": tomlConfig, - "chainlink": chainlinkResources, - "db": dbResources, - }, keeperTestConfig.GetChainlinkImageConfig(), overrideFn) - - testEnvironment.AddHelm(cd) - } - err = testEnvironment.Run() - require.NoError(t, err, "Error launching test environment") - return testEnvironment, testNetwork -} diff --git a/integration-tests/contracts/contract_models.go b/integration-tests/contracts/contract_models.go deleted file mode 100644 index 4615708ca05..00000000000 --- a/integration-tests/contracts/contract_models.go +++ /dev/null @@ -1,449 +0,0 @@ -// Package contracts handles deployment, management, and interactions of smart contracts on various chains -package contracts - -import ( - "context" - "math/big" - "net/http" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" - "github.com/smartcontractkit/libocr/gethwrappers2/ocr2aggregator" - ocrConfigHelper "github.com/smartcontractkit/libocr/offchainreporting/confighelper" - ocrConfigHelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" - - "github.com/smartcontractkit/chainlink-common/pkg/config" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/flux_aggregator_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/llo-feeds/generated/verifier" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/operatorforwarder/generated/operator_factory" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" -) - -type FluxAggregatorOptions struct { - PaymentAmount *big.Int // The amount of LINK paid to each oracle per submission, in wei (units of 10⁻¹⁸ LINK) - Timeout uint32 // The number of seconds after the previous round that are allowed to lapse before allowing an oracle to skip an unfinished round - Validator common.Address // An optional contract address for validating external validation of answers - MinSubValue *big.Int // An immutable check for a lower bound of what submission values are accepted from an oracle - MaxSubValue *big.Int // An immutable check for an upper bound of what submission values are accepted from an oracle - Decimals uint8 // The number of decimals to offset the answer by - Description string // A short description of what is being reported -} - -type FluxAggregatorData struct { - AllocatedFunds *big.Int // The amount of payment yet to be withdrawn by oracles - AvailableFunds *big.Int // The amount of future funding available to oracles - LatestRoundData RoundData // Data about the latest round - Oracles []common.Address // Addresses of oracles on the contract -} - -type FluxAggregatorSetOraclesOptions struct { - AddList []common.Address // oracle addresses to add - RemoveList []common.Address // oracle addresses to remove - AdminList []common.Address // oracle addresses to become admin - MinSubmissions uint32 // min amount of submissions in round - MaxSubmissions uint32 // max amount of submissions in round - RestartDelayRounds uint32 // rounds to wait after oracles has changed -} - -type SubmissionEvent struct { - Contract common.Address - Submission *big.Int - Round uint32 - BlockNumber uint64 - Oracle common.Address -} - -type FluxAggregator interface { - Address() string - Fund(ethAmount *big.Float) error - LatestRoundID(ctx context.Context) (*big.Int, error) - LatestRoundData(ctx context.Context) (flux_aggregator_wrapper.LatestRoundData, error) - GetContractData(ctxt context.Context) (*FluxAggregatorData, error) - UpdateAvailableFunds() error - PaymentAmount(ctx context.Context) (*big.Int, error) - RequestNewRound(ctx context.Context) error - WithdrawPayment(ctx context.Context, from common.Address, to common.Address, amount *big.Int) error - WithdrawablePayment(ctx context.Context, addr common.Address) (*big.Int, error) - GetOracles(ctx context.Context) ([]string, error) - SetOracles(opts FluxAggregatorSetOraclesOptions) error - Description(ctxt context.Context) (string, error) - SetRequesterPermissions(ctx context.Context, addr common.Address, authorized bool, roundsDelay uint32) error - WatchSubmissionReceived(ctx context.Context, eventChan chan<- *SubmissionEvent) error -} - -type LinkToken interface { - Address() string - Approve(to string, amount *big.Int) error - Transfer(to string, amount *big.Int) error - BalanceOf(ctx context.Context, addr string) (*big.Int, error) - TransferAndCall(to string, amount *big.Int, data []byte) (*types.Transaction, error) - TransferAndCallFromKey(to string, amount *big.Int, data []byte, keyNum int) (*types.Transaction, error) - Name(context.Context) (string, error) - Decimals() uint -} - -type WETHToken interface { - Address() string - Approve(to string, amount *big.Int) error - Transfer(to string, amount *big.Int) error - BalanceOf(ctx context.Context, addr string) (*big.Int, error) - Name(context.Context) (string, error) - Decimals() uint -} - -type OffchainOptions struct { - MaximumGasPrice uint32 // The highest gas price for which transmitter will be compensated - ReasonableGasPrice uint32 // The transmitter will receive reward for gas prices under this value - MicroLinkPerEth uint32 // The reimbursement per ETH of gas cost, in 1e-6LINK units - LinkGweiPerObservation uint32 // The reward to the oracle for contributing an observation to a successfully transmitted report, in 1e-9LINK units - LinkGweiPerTransmission uint32 // The reward to the transmitter of a successful report, in 1e-9LINK units - MinimumAnswer *big.Int // The lowest answer the median of a report is allowed to be - MaximumAnswer *big.Int // The highest answer the median of a report is allowed to be - BillingAccessController common.Address // The access controller for billing admin functions - RequesterAccessController common.Address // The access controller for requesting new rounds - Decimals uint8 // Answers are stored in fixed-point format, with this many digits of precision - Description string // A short description of what is being reported -} - -// https://uploads-ssl.webflow.com/5f6b7190899f41fb70882d08/603651a1101106649eef6a53_chainlink-ocr-protocol-paper-02-24-20.pdf -type OffChainAggregatorConfig struct { - DeltaProgress time.Duration // The duration in which a leader must achieve progress or be replaced - DeltaResend time.Duration // The interval at which nodes resend NEWEPOCH messages - DeltaRound time.Duration // The duration after which a new round is started - DeltaGrace time.Duration // The duration of the grace period during which delayed oracles can still submit observations - DeltaC time.Duration // Limits how often updates are transmitted to the contract as long as the median isn’t changing by more then AlphaPPB - AlphaPPB uint64 // Allows larger changes of the median to be reported immediately, bypassing DeltaC - DeltaStage time.Duration // Used to stagger stages of the transmission protocol. Multiple Ethereum blocks must be mineable in this period - RMax uint8 // The maximum number of rounds in an epoch - S []int // Transmission Schedule - F int // The allowed number of "bad" oracles - N int // The number of oracles - OracleIdentities []ocrConfigHelper.OracleIdentityExtra -} - -type OffChainAggregatorV2Config struct { - DeltaProgress *config.Duration `toml:",omitempty"` - DeltaResend *config.Duration `toml:",omitempty"` - DeltaRound *config.Duration `toml:",omitempty"` - DeltaGrace *config.Duration `toml:",omitempty"` - DeltaStage *config.Duration `toml:",omitempty"` - RMax uint8 `toml:"-"` - S []int `toml:"-"` - Oracles []ocrConfigHelper2.OracleIdentityExtra `toml:"-"` - ReportingPluginConfig []byte `toml:"-"` - MaxDurationQuery *config.Duration `toml:",omitempty"` - MaxDurationObservation *config.Duration `toml:",omitempty"` - MaxDurationReport *config.Duration `toml:",omitempty"` - MaxDurationShouldAcceptFinalizedReport *config.Duration `toml:",omitempty"` - MaxDurationShouldTransmitAcceptedReport *config.Duration `toml:",omitempty"` - F int `toml:"-"` - OnchainConfig []byte `toml:"-"` -} - -type OffchainAggregatorData struct { - LatestRoundData RoundData // Data about the latest round -} - -type ChainlinkNodeWithKeysAndAddress interface { - MustReadOCRKeys() (*nodeclient.OCRKeys, error) - MustReadP2PKeys() (*nodeclient.P2PKeys, error) - PrimaryEthAddress() (string, error) - EthAddresses() ([]string, error) - ChainlinkKeyExporter -} - -type ChainlinkKeyExporter interface { - ExportEVMKeysForChain(string) ([]*nodeclient.ExportedEVMKey, error) -} - -type ChainlinkNodeWithForwarder interface { - TrackForwarder(chainID *big.Int, address common.Address) (*nodeclient.Forwarder, *http.Response, error) - GetConfig() nodeclient.ChainlinkConfig -} - -type OffChainAggregatorWithRounds interface { - Address() string - GetLatestRound(ctx context.Context) (*RoundData, error) - RequestNewRound() error -} - -type OffchainAggregator interface { - Address() string - SetConfig(chainlinkNodes []ChainlinkNodeWithKeysAndAddress, ocrConfig OffChainAggregatorConfig, transmitters []common.Address) error - SetPayees([]string, []string) error - RequestNewRound() error - GetLatestAnswer(ctx context.Context) (*big.Int, error) - GetLatestRound(ctx context.Context) (*RoundData, error) - GetRound(ctx context.Context, roundID *big.Int) (*RoundData, error) - ParseEventAnswerUpdated(log types.Log) (*offchainaggregator.OffchainAggregatorAnswerUpdated, error) - LatestRoundDataUpdatedAt() (*big.Int, error) -} - -type OffchainAggregatorV2 interface { - Address() string - RequestNewRound() error - SetConfig(ocrConfig *OCRv2Config) error - SetPayees(transmitters, payees []string) error - GetLatestAnswer(ctx context.Context) (*big.Int, error) - GetLatestRound(ctx context.Context) (*RoundData, error) - GetRound(ctx context.Context, roundID *big.Int) (*RoundData, error) - ParseEventAnswerUpdated(log types.Log) (*ocr2aggregator.OCR2AggregatorAnswerUpdated, error) -} - -type KeeperRegistryCheckUpkeepGasUsageWrapper interface { - Address() string -} - -type Oracle interface { - Address() string - Fund(ethAmount *big.Float) error - SetFulfillmentPermission(address string, allowed bool) error -} - -type APIConsumer interface { - Address() string - RoundID(ctx context.Context) (*big.Int, error) - Fund(ethAmount *big.Float) error - Data(ctx context.Context) (*big.Int, error) - CreateRequestTo( - oracleAddr string, - jobID [32]byte, - payment *big.Int, - url string, - path string, - times *big.Int, - ) error -} - -type Storage interface { - Get(ctxt context.Context) (*big.Int, error) - Set(*big.Int) error -} - -// JobByInstance helper struct to match job + instance ID -type JobByInstance struct { - ID string - Instance string -} - -type MockLINKETHFeed interface { - Address() string - LatestRoundData() (*big.Int, error) - LatestRoundDataUpdatedAt() (*big.Int, error) -} - -type MockETHLINKFeed interface { - Address() string - LatestRoundData() (*big.Int, error) - LatestRoundDataUpdatedAt() (*big.Int, error) -} - -type MockETHUSDFeed interface { - Address() string - LatestRoundData() (*big.Int, error) - LatestRoundDataUpdatedAt() (*big.Int, error) - Decimals() uint -} - -type MockGasFeed interface { - Address() string -} - -type BlockHashStore interface { - Address() string - GetBlockHash(ctx context.Context, blockNumber *big.Int) ([32]byte, error) - StoreVerifyHeader(blockNumber *big.Int, blockHeader []byte) error -} - -type Staking interface { - Address() string - Fund(ethAmount *big.Float) error - AddOperators(operators []common.Address) error - RemoveOperators(operators []common.Address) error - SetFeedOperators(operators []common.Address) error - RaiseAlert() error - Start(amount *big.Int, initialRewardRate *big.Int) error - SetMerkleRoot(newMerkleRoot [32]byte) error -} - -type StakingEventsMock interface { - Address() string - PoolSizeIncreased(maxPoolSize *big.Int) error - MaxCommunityStakeAmountIncreased(maxStakeAmount *big.Int) error - MaxOperatorStakeAmountIncreased(maxStakeAmount *big.Int) error - RewardInitialized(rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) error - AlertRaised(alerter common.Address, roundId *big.Int, rewardAmount *big.Int) error - Staked(staker common.Address, newStake *big.Int, totalStake *big.Int) error - OperatorAdded(operator common.Address) error - OperatorRemoved(operator common.Address, amount *big.Int) error - FeedOperatorsSet(feedOperators []common.Address) error -} - -type OffchainAggregatorEventsMock interface { - Address() string - ConfigSet(previousConfigBlockNumber uint32, configCount uint64, signers []common.Address, transmitters []common.Address, threshold uint8, encodedConfigVersion uint64, encoded []byte) error - NewTransmission(aggregatorRoundId uint32, answer *big.Int, transmitter common.Address, observations []*big.Int, observers []byte, rawReportContext [32]byte) error -} - -type KeeperRegistry11Mock interface { - Address() string - EmitUpkeepPerformed(id *big.Int, success bool, from common.Address, payment *big.Int, performData []byte) error - EmitUpkeepCanceled(id *big.Int, atBlockHeight uint64) error - EmitFundsWithdrawn(id *big.Int, amount *big.Int, to common.Address) error - EmitKeepersUpdated(keepers []common.Address, payees []common.Address) error - EmitUpkeepRegistered(id *big.Int, executeGas uint32, admin common.Address) error - EmitFundsAdded(id *big.Int, from common.Address, amount *big.Int) error - SetUpkeepCount(_upkeepCount *big.Int) error - SetCanceledUpkeepList(_canceledUpkeepList []*big.Int) error - SetKeeperList(_keepers []common.Address) error - SetConfig(_paymentPremiumPPB uint32, _flatFeeMicroLink uint32, _blockCountPerTurn *big.Int, _checkGasLimit uint32, _stalenessSeconds *big.Int, _gasCeilingMultiplier uint16, _fallbackGasPrice *big.Int, _fallbackLinkPrice *big.Int) error - SetUpkeep(id *big.Int, _target common.Address, _executeGas uint32, _balance *big.Int, _admin common.Address, _maxValidBlocknumber uint64, _lastKeeper common.Address, _checkData []byte) error - SetMinBalance(id *big.Int, minBalance *big.Int) error - SetCheckUpkeepData(id *big.Int, performData []byte, maxLinkPayment *big.Int, gasLimit *big.Int, adjustedGasWei *big.Int, linkEth *big.Int) error - SetPerformUpkeepSuccess(id *big.Int, success bool) error -} - -type KeeperRegistrar12Mock interface { - Address() string - EmitRegistrationRequested(hash [32]byte, name string, encryptedEmail []byte, upkeepContract common.Address, gasLimit uint32, adminAddress common.Address, checkData []byte, amount *big.Int, source uint8) error - EmitRegistrationApproved(hash [32]byte, displayName string, upkeepId *big.Int) error - SetRegistrationConfig(_autoApproveConfigType uint8, _autoApproveMaxAllowed uint32, _approvedCount uint32, _keeperRegistry common.Address, _minLINKJuels *big.Int) error -} - -type KeeperGasWrapperMock interface { - Address() string - SetMeasureCheckGasResult(result bool, payload []byte, gas *big.Int) error -} - -type FunctionsV1EventsMock interface { - Address() string - EmitRequestProcessed(requestId [32]byte, subscriptionId uint64, totalCostJuels *big.Int, transmitter common.Address, resultCode uint8, response []byte, errByte []byte, callbackReturnData []byte) error - EmitRequestStart(requestId [32]byte, donId [32]byte, subscriptionId uint64, subscriptionOwner common.Address, requestingContract common.Address, requestInitiator common.Address, data []byte, dataVersion uint16, callbackGasLimit uint32, estimatedTotalCostJuels *big.Int) error - EmitSubscriptionCanceled(subscriptionId uint64, fundsRecipient common.Address, fundsAmount *big.Int) error - EmitSubscriptionConsumerAdded(subscriptionId uint64, consumer common.Address) error - EmitSubscriptionConsumerRemoved(subscriptionId uint64, consumer common.Address) error - EmitSubscriptionCreated(subscriptionId uint64, owner common.Address) error - EmitSubscriptionFunded(subscriptionId uint64, oldBalance *big.Int, newBalance *big.Int) error - EmitSubscriptionOwnerTransferred(subscriptionId uint64, from common.Address, to common.Address) error - EmitSubscriptionOwnerTransferRequested(subscriptionId uint64, from common.Address, to common.Address) error - EmitRequestNotProcessed(requestId [32]byte, coordinator common.Address, transmitter common.Address, resultCode uint8) error - EmitContractUpdated(id [32]byte, from common.Address, to common.Address) error -} - -type MockAggregatorProxy interface { - Address() string - UpdateAggregator(aggregator common.Address) error - Aggregator() (common.Address, error) -} - -type RoundData struct { - RoundId *big.Int - Answer *big.Int - StartedAt *big.Int - UpdatedAt *big.Int - AnsweredInRound *big.Int -} - -// ReadAccessController is read/write access controller, just named by interface -type ReadAccessController interface { - Address() string - AddAccess(addr string) error - DisableAccessCheck() error -} - -// Flags flags contract interface -type Flags interface { - Address() string - GetFlag(ctx context.Context, addr string) (bool, error) -} - -// OperatorFactory creates Operator contracts for node operators -type OperatorFactory interface { - Address() string - DeployNewOperatorAndForwarder() (*types.Transaction, error) - ParseAuthorizedForwarderCreated(log types.Log) (*operator_factory.OperatorFactoryAuthorizedForwarderCreated, error) - ParseOperatorCreated(log types.Log) (*operator_factory.OperatorFactoryOperatorCreated, error) -} - -// Operator operates forwarders -type Operator interface { - Address() string - AcceptAuthorizedReceivers(forwarders []common.Address, eoa []common.Address) error -} - -// AuthorizedForwarder forward requests from cll nodes eoa -type AuthorizedForwarder interface { - Address() string - Owner(ctx context.Context) (string, error) - GetAuthorizedSenders(ctx context.Context) ([]string, error) -} - -type FunctionsCoordinator interface { - Address() string - GetThresholdPublicKey() ([]byte, error) - GetDONPublicKey() ([]byte, error) -} - -type FunctionsRouter interface { - Address() string - CreateSubscriptionWithConsumer(consumer string) (uint64, error) -} - -type FunctionsLoadTestClient interface { - Address() string - ResetStats() error - GetStats() (*EthereumFunctionsLoadStats, error) - SendRequest(times uint32, source string, encryptedSecretsReferences []byte, args []string, subscriptionId uint64, jobId [32]byte) error - SendRequestWithDONHostedSecrets(times uint32, source string, slotID uint8, slotVersion uint64, args []string, subscriptionId uint64, donID [32]byte) error -} - -type MercuryVerifier interface { - Address() common.Address - Verify(signedReport []byte, sender common.Address) error - SetConfig(feedId [32]byte, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []verifier.CommonAddressAndWeight) (*types.Transaction, error) - LatestConfigDetails(ctx context.Context, feedId [32]byte) (verifier.LatestConfigDetails, error) -} - -type MercuryVerifierProxy interface { - Address() common.Address - InitializeVerifier(verifierAddress common.Address) (*types.Transaction, error) - Verify(signedReport []byte, parameterPayload []byte, value *big.Int) (*types.Transaction, error) - VerifyBulk(signedReports [][]byte, parameterPayload []byte, value *big.Int) (*types.Transaction, error) - SetFeeManager(feeManager common.Address) (*types.Transaction, error) -} - -type MercuryFeeManager interface { - Address() common.Address - UpdateSubscriberDiscount(subscriber common.Address, feedId [32]byte, token common.Address, discount uint64) (*types.Transaction, error) -} - -type MercuryRewardManager interface { - Address() common.Address - SetFeeManager(feeManager common.Address) (*types.Transaction, error) -} - -type WERC20Mock interface { - Address() common.Address - BalanceOf(ctx context.Context, addr string) (*big.Int, error) - Approve(to string, amount *big.Int) error - Transfer(to string, amount *big.Int) error - Mint(account common.Address, amount *big.Int) (*types.Transaction, error) -} - -type LogEmitter interface { - Address() common.Address - EmitLogInts(ints []int) (*types.Transaction, error) - EmitLogIntsIndexed(ints []int) (*types.Transaction, error) - EmitLogIntMultiIndexed(ints int, ints2 int, count int) (*types.Transaction, error) - EmitLogStrings(strings []string) (*types.Transaction, error) - EmitLogIntsFromKey(ints []int, keyNum int) (*types.Transaction, error) - EmitLogIntsIndexedFromKey(ints []int, keyNum int) (*types.Transaction, error) - EmitLogIntMultiIndexedFromKey(ints int, ints2 int, count int, keyNum int) (*types.Transaction, error) - EmitLogStringsFromKey(strings []string, keyNum int) (*types.Transaction, error) - EmitLogInt(payload int) (*types.Transaction, error) - EmitLogIntIndexed(payload int) (*types.Transaction, error) - EmitLogString(strings string) (*types.Transaction, error) -} diff --git a/integration-tests/contracts/contract_vrf_models.go b/integration-tests/contracts/contract_vrf_models.go deleted file mode 100644 index 955043254d6..00000000000 --- a/integration-tests/contracts/contract_vrf_models.go +++ /dev/null @@ -1,391 +0,0 @@ -package contracts - -import ( - "context" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_load_test_with_metrics" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_owner" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2_consumer_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_load_test_with_metrics" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_upgraded_version" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2_wrapper_load_test_consumer" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" -) - -type VRF interface { - Fund(ethAmount *big.Float) error - ProofLength(context.Context) (*big.Int, error) -} - -type VRFCoordinator interface { - RegisterProvingKey( - fee *big.Int, - oracleAddr string, - publicProvingKey [2]*big.Int, - jobID [32]byte, - ) error - HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) - Address() string -} - -type VRFCoordinatorV2 interface { - GetRequestConfig(ctx context.Context) (GetRequestConfig, error) - GetConfig(ctx context.Context) (vrf_coordinator_v2.GetConfig, error) - GetFallbackWeiPerUnitLink(ctx context.Context) (*big.Int, error) - GetFeeConfig(ctx context.Context) (vrf_coordinator_v2.GetFeeConfig, error) - SetConfig( - minimumRequestConfirmations uint16, - maxGasLimit uint32, - stalenessSeconds uint32, - gasAfterPaymentCalculation uint32, - fallbackWeiPerUnitLink *big.Int, - feeConfig vrf_coordinator_v2.VRFCoordinatorV2FeeConfig, - ) error - RegisterProvingKey( - oracleAddr string, - publicProvingKey [2]*big.Int, - ) error - TransferOwnership(to common.Address) error - HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) - CreateSubscription() (*types.Receipt, error) - AddConsumer(subId uint64, consumerAddress string) error - Address() string - GetSubscription(ctx context.Context, subID uint64) (Subscription, error) - GetOwner(ctx context.Context) (common.Address, error) - PendingRequestsExist(ctx context.Context, subID uint64) (bool, error) - OwnerCancelSubscription(subID uint64) (*seth.DecodedTransaction, *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) - CancelSubscription(subID uint64, to common.Address) (*seth.DecodedTransaction, *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) - ParseSubscriptionCanceled(log types.Log) (*vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) - ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) - ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) - ParseLog(log types.Log) (generated.AbigenLog, error) - FindSubscriptionID(subID uint64) (uint64, error) - FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) - WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) - WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) - OracleWithdraw(recipient common.Address, amount *big.Int) error - GetBlockHashStoreAddress(ctx context.Context) (common.Address, error) - GetLinkAddress(ctx context.Context) (common.Address, error) - GetLinkNativeFeed(ctx context.Context) (common.Address, error) -} - -type VRFCoordinatorV2_5 interface { - SetLINKAndLINKNativeFeed( - link string, - linkNativeFeed string, - ) error - SetConfig( - minimumRequestConfirmations uint16, - maxGasLimit uint32, - stalenessSeconds uint32, - gasAfterPaymentCalculation uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, - nativePremiumPercentage uint8, - linkPremiumPercentage uint8, - ) error - RegisterProvingKey( - publicProvingKey [2]*big.Int, - gasLaneMaxGas uint64, - ) error - HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) - CreateSubscription() (*types.Transaction, error) - GetActiveSubscriptionIds(ctx context.Context, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error) - Migrate(subId *big.Int, coordinatorAddress string) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted, error) - RegisterMigratableCoordinator(migratableCoordinatorAddress string) error - AddConsumer(subId *big.Int, consumerAddress string) error - FundSubscriptionWithNative(subId *big.Int, nativeTokenAmount *big.Int) error - Address() string - PendingRequestsExist(ctx context.Context, subID *big.Int) (bool, error) - GetSubscription(ctx context.Context, subID *big.Int) (Subscription, error) - OwnerCancelSubscription(subID *big.Int) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled, error) - CancelSubscription(subID *big.Int, to common.Address) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled, error) - Withdraw(recipient common.Address) error - WithdrawNative(recipient common.Address) error - GetNativeTokenTotalBalance(ctx context.Context) (*big.Int, error) - GetLinkTotalBalance(ctx context.Context) (*big.Int, error) - FindSubscriptionID(subID *big.Int) (*big.Int, error) - FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) - WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) - ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) - ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) - WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) - GetBlockHashStoreAddress(ctx context.Context) (common.Address, error) - GetLinkAddress(ctx context.Context) (common.Address, error) - GetLinkNativeFeed(ctx context.Context) (common.Address, error) - GetConfig(ctx context.Context) (vrf_coordinator_v2_5.SConfig, error) -} - -type VRFCoordinatorV2PlusUpgradedVersion interface { - SetLINKAndLINKNativeFeed( - link string, - linkNativeFeed string, - ) error - SetConfig( - minimumRequestConfirmations uint16, - maxGasLimit uint32, - stalenessSeconds uint32, - gasAfterPaymentCalculation uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, - nativePremiumPercentage uint8, - linkPremiumPercentage uint8, - ) error - RegisterProvingKey( - publicProvingKey [2]*big.Int, - gasLaneMaxGasPrice uint64, - ) error - HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) - CreateSubscription() error - GetNativeTokenTotalBalance(ctx context.Context) (*big.Int, error) - GetLinkTotalBalance(ctx context.Context) (*big.Int, error) - Migrate(subId *big.Int, coordinatorAddress string) error - RegisterMigratableCoordinator(migratableCoordinatorAddress string) error - AddConsumer(subId *big.Int, consumerAddress string) error - FundSubscriptionWithNative(subId *big.Int, nativeTokenAmount *big.Int) error - Address() string - GetSubscription(ctx context.Context, subID *big.Int) (vrf_v2plus_upgraded_version.GetSubscription, error) - GetActiveSubscriptionIds(ctx context.Context, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error) - FindSubscriptionID() (*big.Int, error) - FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) - WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) - ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) - ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) - WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) -} - -type VRFV2Wrapper interface { - Address() string - SetConfig(wrapperGasOverhead uint32, coordinatorGasOverhead uint32, wrapperPremiumPercentage uint8, keyHash [32]byte, maxNumWords uint8) error - GetSubID(ctx context.Context) (uint64, error) -} - -type VRFV2PlusWrapper interface { - Address() string - SetConfig( - wrapperGasOverhead uint32, - coordinatorGasOverheadNative uint32, - coordinatorGasOverheadLink uint32, - coordinatorGasOverheadPerWord uint16, - wrapperNativePremiumPercentage uint8, - wrapperLinkPremiumPercentage uint8, - keyHash [32]byte, maxNumWords uint8, - stalenessSeconds uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, - ) error - GetSubID(ctx context.Context) (*big.Int, error) - Coordinator(ctx context.Context) (common.Address, error) -} - -type VRFOwner interface { - Address() string - SetAuthorizedSenders(senders []common.Address) error - AcceptVRFOwnership() error - WaitForRandomWordsForcedEvent(requestIDs []*big.Int, subIds []uint64, senders []common.Address, timeout time.Duration) (*vrf_owner.VRFOwnerRandomWordsForced, error) - OwnerCancelSubscription(subID uint64) (*types.Transaction, error) -} - -type VRFConsumer interface { - Address() string - RequestRandomness(hash [32]byte, fee *big.Int) error - CurrentRoundID(ctx context.Context) (*big.Int, error) - RandomnessOutput(ctx context.Context) (*big.Int, error) - Fund(ethAmount *big.Float) error -} - -type VRFConsumerV2 interface { - Address() string - CurrentSubscription() (uint64, error) - CreateFundedSubscription(funds *big.Int) error - TopUpSubscriptionFunds(funds *big.Int) error - RequestRandomness(hash [32]byte, subID uint64, confs uint16, gasLimit uint32, numWords uint32) error - RandomnessOutput(ctx context.Context, arg0 *big.Int) (*big.Int, error) - GetAllRandomWords(ctx context.Context, num int) ([]*big.Int, error) - GasAvailable() (*big.Int, error) - Fund(ethAmount *big.Float) error -} - -type VRFv2Consumer interface { - Address() string - RequestRandomness(hash [32]byte, subID uint64, confs uint16, gasLimit uint32, numWords uint32) error - GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_v2_consumer_wrapper.GetRequestStatus, error) - GetLastRequestId(ctx context.Context) (*big.Int, error) -} - -type VRFv2LoadTestConsumer interface { - Address() string - RequestRandomness( - coordinator Coordinator, - keyHash [32]byte, - subID uint64, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - ) (*CoordinatorRandomWordsRequested, error) - RequestRandomnessFromKey( - coordinator Coordinator, - keyHash [32]byte, - subID uint64, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - keyNum int, - ) (*CoordinatorRandomWordsRequested, error) - RequestRandomWordsWithForceFulfill( - coordinator Coordinator, - keyHash [32]byte, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - subTopUpAmount *big.Int, - linkAddress common.Address, - ) (*CoordinatorRandomWordsRequested, error) - GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_load_test_with_metrics.GetRequestStatus, error) - GetLastRequestId(ctx context.Context) (*big.Int, error) - GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) - ResetMetrics() error -} - -type VRFv2WrapperLoadTestConsumer interface { - Address() string - Fund(ethAmount *big.Float) error - RequestRandomness(coordinator Coordinator, requestConfirmations uint16, callbackGasLimit uint32, numWords uint32, requestCount uint16) (*CoordinatorRandomWordsRequested, error) - GetRequestStatus(ctx context.Context, requestID *big.Int) (vrfv2_wrapper_load_test_consumer.GetRequestStatus, error) - GetLastRequestId(ctx context.Context) (*big.Int, error) - GetWrapper(ctx context.Context) (common.Address, error) - GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) -} - -type VRFv2PlusLoadTestConsumer interface { - Address() string - RequestRandomness( - coordinator Coordinator, - keyHash [32]byte, subID *big.Int, - requestConfirmations uint16, - callbackGasLimit uint32, - nativePayment bool, - numWords uint32, - requestCount uint16, - ) (*CoordinatorRandomWordsRequested, error) - RequestRandomnessFromKey( - coordinator Coordinator, - keyHash [32]byte, subID *big.Int, - requestConfirmations uint16, - callbackGasLimit uint32, - nativePayment bool, - numWords uint32, - requestCount uint16, - keyNum int, - ) (*CoordinatorRandomWordsRequested, error) - GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_v2plus_load_test_with_metrics.GetRequestStatus, error) - GetLastRequestId(ctx context.Context) (*big.Int, error) - GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) - GetCoordinator(ctx context.Context) (common.Address, error) - ResetMetrics() error -} - -type VRFv2PlusWrapperLoadTestConsumer interface { - Address() string - Fund(ethAmount *big.Float) error - RequestRandomness( - coordinator Coordinator, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - ) (*CoordinatorRandomWordsRequested, error) - RequestRandomnessNative( - coordinator Coordinator, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - ) (*CoordinatorRandomWordsRequested, error) - GetRequestStatus(ctx context.Context, requestID *big.Int) (vrfv2plus_wrapper_load_test_consumer.GetRequestStatus, error) - GetLastRequestId(ctx context.Context) (*big.Int, error) - GetWrapper(ctx context.Context) (common.Address, error) - GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) -} - -type VRFBeaconConsumer interface { - Address() string - RequestRandomness( - numWords uint16, - subID, confirmationDelayArg *big.Int, - ) (*types.Receipt, error) - RedeemRandomness(subID, requestID *big.Int) error - RequestRandomnessFulfillment( - numWords uint16, - subID, confirmationDelayArg *big.Int, - requestGasLimit, - callbackGasLimit uint32, - arguments []byte, - ) (*types.Receipt, error) - IBeaconPeriodBlocks(ctx context.Context) (*big.Int, error) - GetRequestIdsBy(ctx context.Context, nextBeaconOutputHeight *big.Int, confDelay *big.Int) (*big.Int, error) - GetRandomnessByRequestId(ctx context.Context, requestID *big.Int, numWordIndex *big.Int) (*big.Int, error) -} - -type BatchBlockhashStore interface { - Address() string -} - -type BatchVRFCoordinatorV2 interface { - Address() string -} -type BatchVRFCoordinatorV2Plus interface { - Address() string -} - -type VRFMockETHLINKFeed interface { - Address() string - LatestRoundData() (*big.Int, error) - LatestRoundDataUpdatedAt() (*big.Int, error) - SetBlockTimestampDeduction(blockTimestampDeduction *big.Int) error -} - -type RequestStatus struct { - Fulfilled bool - RandomWords []*big.Int -} - -type LoadTestRequestStatus struct { - Fulfilled bool - RandomWords []*big.Int - // Currently Unused November 8, 2023, Mignt be used in near future, will remove if not. - // requestTimestamp *big.Int - // fulfilmentTimestamp *big.Int - // requestBlockNumber *big.Int - // fulfilmentBlockNumber *big.Int -} - -type VRFLoadTestMetrics struct { - RequestCount *big.Int - FulfilmentCount *big.Int - AverageFulfillmentInMillions *big.Int - SlowestFulfillment *big.Int - FastestFulfillment *big.Int - P90FulfillmentBlockTime float64 - P95FulfillmentBlockTime float64 - AverageResponseTimeInSecondsMillions *big.Int - SlowestResponseTimeInSeconds *big.Int - FastestResponseTimeInSeconds *big.Int -} diff --git a/integration-tests/contracts/contracts.go b/integration-tests/contracts/contracts.go new file mode 100644 index 00000000000..285c09031fc --- /dev/null +++ b/integration-tests/contracts/contracts.go @@ -0,0 +1,47 @@ +package contracts + +import ( + "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" + + "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" +) + +type OffChainAggregatorV2Config struct { + DeltaProgress *config.Duration `toml:",omitempty"` + DeltaResend *config.Duration `toml:",omitempty"` + DeltaRound *config.Duration `toml:",omitempty"` + DeltaGrace *config.Duration `toml:",omitempty"` + DeltaStage *config.Duration `toml:",omitempty"` + RMax uint8 `toml:"-"` + S []int `toml:"-"` + Oracles []confighelper.OracleIdentityExtra `toml:"-"` + ReportingPluginConfig []byte `toml:"-"` + MaxDurationQuery *config.Duration `toml:",omitempty"` + MaxDurationObservation *config.Duration `toml:",omitempty"` + MaxDurationReport *config.Duration `toml:",omitempty"` + MaxDurationShouldAcceptFinalizedReport *config.Duration `toml:",omitempty"` + MaxDurationShouldTransmitAcceptedReport *config.Duration `toml:",omitempty"` + F int `toml:"-"` + OnchainConfig []byte `toml:"-"` +} + +type ChainlinkKeyExporter interface { + ExportEVMKeysForChain(string) ([]*nodeclient.ExportedEVMKey, error) +} + +type ChainlinkNodeWithKeysAndAddress interface { + MustReadOCRKeys() (*nodeclient.OCRKeys, error) + MustReadP2PKeys() (*nodeclient.P2PKeys, error) + PrimaryEthAddress() (string, error) + EthAddresses() ([]string, error) + ChainlinkKeyExporter +} + +func ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(k8sNodes []*nodeclient.ChainlinkK8sClient) []ChainlinkNodeWithKeysAndAddress { + nodes := make([]ChainlinkNodeWithKeysAndAddress, len(k8sNodes)) + for i, node := range k8sNodes { + nodes[i] = node + } + return nodes +} diff --git a/integration-tests/contracts/ethereum/KeeperRegistryVersions.go b/integration-tests/contracts/ethereum/KeeperRegistryVersions.go deleted file mode 100644 index d5d0c2edeae..00000000000 --- a/integration-tests/contracts/ethereum/KeeperRegistryVersions.go +++ /dev/null @@ -1,23 +0,0 @@ -package ethereum - -import ( - "github.com/ethereum/go-ethereum/common" -) - -// AbigenLog is an interface for abigen generated log topics -type AbigenLog interface { - Topic() common.Hash -} - -type KeeperRegistryVersion int32 - -const ( - RegistryVersion_1_0 KeeperRegistryVersion = iota - RegistryVersion_1_1 - RegistryVersion_1_2 - RegistryVersion_1_3 - RegistryVersion_2_0 - RegistryVersion_2_1 - RegistryVersion_2_2 - RegistryVersion_2_3 -) diff --git a/integration-tests/contracts/ethereum/OffchainAggregatorEventsMock.go b/integration-tests/contracts/ethereum/OffchainAggregatorEventsMock.go deleted file mode 100644 index f35ac821476..00000000000 --- a/integration-tests/contracts/ethereum/OffchainAggregatorEventsMock.go +++ /dev/null @@ -1,2583 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package ethereum - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -var OffchainAggregatorEventsMockMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"AnswerUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"BillingAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"maximumGasPrice\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"reasonableGasPrice\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"microLinkPerEth\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"linkGweiPerObservation\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"linkGweiPerTransmission\",\"type\":\"uint32\"}],\"name\":\"BillingSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"configCount\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"threshold\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"encodedConfigVersion\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"encoded\",\"type\":\"bytes\"}],\"name\":\"ConfigSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_oldLinkToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newLinkToken\",\"type\":\"address\"}],\"name\":\"LinkTokenSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"NewRound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"rawReportContext\",\"type\":\"bytes32\"}],\"name\":\"NewTransmission\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"linkToken\",\"type\":\"address\"}],\"name\":\"OraclePaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"proposed\",\"type\":\"address\"}],\"name\":\"PayeeshipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previous\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"PayeeshipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"old\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"RequesterAccessControllerSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes16\",\"name\":\"configDigest\",\"type\":\"bytes16\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"RoundRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"ValidatorConfigSet\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"current\",\"type\":\"int256\"},{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"updatedAt\",\"type\":\"uint256\"}],\"name\":\"emitAnswerUpdated\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"old\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"emitBillingAccessControllerSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"maximumGasPrice\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"reasonableGasPrice\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"microLinkPerEth\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"linkGweiPerObservation\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"linkGweiPerTransmission\",\"type\":\"uint32\"}],\"name\":\"emitBillingSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"configCount\",\"type\":\"uint64\"},{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"transmitters\",\"type\":\"address[]\"},{\"internalType\":\"uint8\",\"name\":\"threshold\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"encodedConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"encoded\",\"type\":\"bytes\"}],\"name\":\"emitConfigSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oldLinkToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newLinkToken\",\"type\":\"address\"}],\"name\":\"emitLinkTokenSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"startedBy\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"startedAt\",\"type\":\"uint256\"}],\"name\":\"emitNewRound\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"aggregatorRoundId\",\"type\":\"uint32\"},{\"internalType\":\"int192\",\"name\":\"answer\",\"type\":\"int192\"},{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"int192[]\",\"name\":\"observations\",\"type\":\"int192[]\"},{\"internalType\":\"bytes\",\"name\":\"observers\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"rawReportContext\",\"type\":\"bytes32\"}],\"name\":\"emitNewTransmission\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"linkToken\",\"type\":\"address\"}],\"name\":\"emitOraclePaid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emitOwnershipTransferRequested\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emitOwnershipTransferred\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"proposed\",\"type\":\"address\"}],\"name\":\"emitPayeeshipTransferRequested\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"transmitter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"previous\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"emitPayeeshipTransferred\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"old\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"current\",\"type\":\"address\"}],\"name\":\"emitRequesterAccessControllerSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"bytes16\",\"name\":\"configDigest\",\"type\":\"bytes16\"},{\"internalType\":\"uint32\",\"name\":\"epoch\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"round\",\"type\":\"uint8\"}],\"name\":\"emitRoundRequested\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"previousGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"currentValidator\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"currentGasLimit\",\"type\":\"uint32\"}],\"name\":\"emitValidatorConfigSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610faf806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638b28369d11610097578063a57c1e0c11610066578063a57c1e0c146101cd578063b019b4e8146101e0578063f7420bc2146101f3578063faf1347c1461020657600080fd5b80638b28369d1461018157806395aa14461461019457806399e1a39b146101a7578063a3296557146101ba57600080fd5b806358e1e734116100d357806358e1e734146101355780636602e6ce14610148578063715bd44e1461015b57806389ffde8d1461016e57600080fd5b8063275c7ea4146100fa5780632c769fd71461010f578063448be1e014610122575b600080fd5b61010d610108366004610c76565b610219565b005b61010d61011d366004610aad565b610265565b61010d610130366004610931565b6102a5565b61010d610143366004610964565b6102fa565b61010d610156366004610a64565b610370565b61010d6101693660046109f4565b6103d3565b61010d61017c366004610931565b61045b565b61010d61018f366004610ad9565b6104a8565b61010d6101a2366004610b0e565b6104f1565b61010d6101b5366004610964565b61053f565b61010d6101c8366004610c11565b6105b5565b61010d6101db366004610931565b610614565b61010d6101ee366004610931565b610672565b61010d610201366004610931565b6106d0565b61010d6102143660046109a7565b61072e565b7f25d719d88a4512dd76c7442b910a83360845505894eb444ef299409e180f8fb9878787878787876040516102549796959493929190610e8a565b60405180910390a150505050505050565b81837f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f8360405161029891815260200190565b60405180910390a3505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8085168252831660208201527f793cb73064f3c8cde7e187ae515511e6e56d1ee89bf08b82fa60fb70f8d4891291015b60405180910390a15050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f78af32efdcad432315431e9b03d27e6cd98fb79c405fdc5af7c1714d9c0f75b360405160405180910390a4505050565b6040805163ffffffff80861682528316602082015273ffffffffffffffffffffffffffffffffffffffff80851692908716917fb04e3a37abe9c0fcdfebdeae019a8e2b12ddf53f5d55ffb0caccc1bedaca1541910160405180910390a350505050565b604080517fffffffffffffffffffffffffffffffff000000000000000000000000000000008516815263ffffffff8416602082015260ff831681830152905173ffffffffffffffffffffffffffffffffffffffff8616917f3ea16a923ff4b1df6526e854c9e3a995c43385d70e73359e10623c74f0b52037919081900360600190a250505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8085168252831660208201527f27b89aede8b560578baaa25ee5ce3852c5eecad1e114b941bbd89e1eb4bae63491016102ee565b8173ffffffffffffffffffffffffffffffffffffffff16837f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac602718360405161029891815260200190565b8563ffffffff167ff6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451868686868660405161052f959493929190610dfd565b60405180910390a2505050505050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f84f7c7c80bb8ed2279b4aab5f61cd05e6374073d38f46d7f32de8c30e9e3836760405160405180910390a4505050565b6040805163ffffffff878116825286811660208301528581168284015284811660608301528316608082015290517fd0d9486a2c673e2a4b57fc82e4c8a556b3e2b82dd5db07e2c04a920ca0f469b69181900360a00190a15050505050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4966a50c93f855342ccf6c5c0d358b85b91335b2acedc7da0932f691f351711a60405160405180910390a35050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a35050565b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fd0b1dac935d85bd54cf0a33b0d41d39f8cf53a968465fc7ea2377526b8ac712c856040516107a491815260200190565b60405180910390a450505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146107d657600080fd5b919050565b600082601f8301126107ec57600080fd5b813560206108016107fc83610f4f565b610f00565b80838252828201915082860187848660051b890101111561082157600080fd5b60005b8581101561084757610835826107b2565b84529284019290840190600101610824565b5090979650505050505050565b600082601f83011261086557600080fd5b813567ffffffffffffffff81111561087f5761087f610f73565b6108b060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610f00565b8181528460208386010111156108c557600080fd5b816020850160208301376000918101602001919091529392505050565b8035601781900b81146107d657600080fd5b803563ffffffff811681146107d657600080fd5b803567ffffffffffffffff811681146107d657600080fd5b803560ff811681146107d657600080fd5b6000806040838503121561094457600080fd5b61094d836107b2565b915061095b602084016107b2565b90509250929050565b60008060006060848603121561097957600080fd5b610982846107b2565b9250610990602085016107b2565b915061099e604085016107b2565b90509250925092565b600080600080608085870312156109bd57600080fd5b6109c6856107b2565b93506109d4602086016107b2565b9250604085013591506109e9606086016107b2565b905092959194509250565b60008060008060808587031215610a0a57600080fd5b610a13856107b2565b935060208501357fffffffffffffffffffffffffffffffff0000000000000000000000000000000081168114610a4857600080fd5b9250610a56604086016108f4565b91506109e960608601610920565b60008060008060808587031215610a7a57600080fd5b610a83856107b2565b9350610a91602086016108f4565b9250610a9f604086016107b2565b91506109e9606086016108f4565b600080600060608486031215610ac257600080fd5b505081359360208301359350604090920135919050565b600080600060608486031215610aee57600080fd5b83359250610afe602085016107b2565b9150604084013590509250925092565b60008060008060008060c08789031215610b2757600080fd5b610b30876108f4565b95506020610b3f8189016108e2565b9550610b4d604089016107b2565b9450606088013567ffffffffffffffff80821115610b6a57600080fd5b818a0191508a601f830112610b7e57600080fd5b8135610b8c6107fc82610f4f565b8082825285820191508585018e878560051b8801011115610bac57600080fd5b600095505b83861015610bd657610bc2816108e2565b835260019590950194918601918601610bb1565b509750505060808a0135925080831115610bef57600080fd5b5050610bfd89828a01610854565b92505060a087013590509295509295509295565b600080600080600060a08688031215610c2957600080fd5b610c32866108f4565b9450610c40602087016108f4565b9350610c4e604087016108f4565b9250610c5c606087016108f4565b9150610c6a608087016108f4565b90509295509295909350565b600080600080600080600060e0888a031215610c9157600080fd5b610c9a886108f4565b9650610ca860208901610908565b9550604088013567ffffffffffffffff80821115610cc557600080fd5b610cd18b838c016107db565b965060608a0135915080821115610ce757600080fd5b610cf38b838c016107db565b9550610d0160808b01610920565b9450610d0f60a08b01610908565b935060c08a0135915080821115610d2557600080fd5b50610d328a828b01610854565b91505092959891949750929550565b600081518084526020808501945080840160005b83811015610d8757815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610d55565b509495945050505050565b6000815180845260005b81811015610db857602081850181015186830182015201610d9c565b81811115610dca576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060a08201601788810b8452602073ffffffffffffffffffffffffffffffffffffffff89168186015260a0604086015282885180855260c087019150828a01945060005b81811015610e60578551850b83529483019491830191600101610e42565b50508581036060870152610e748189610d92565b9450505050508260808301529695505050505050565b63ffffffff88168152600067ffffffffffffffff808916602084015260e06040840152610eba60e0840189610d41565b8381036060850152610ecc8189610d41565b905060ff8716608085015281861660a085015283810360c0850152610ef18186610d92565b9b9a5050505050505050505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610f4757610f47610f73565b604052919050565b600067ffffffffffffffff821115610f6957610f69610f73565b5060051b60200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c6343000806000a", -} - -var OffchainAggregatorEventsMockABI = OffchainAggregatorEventsMockMetaData.ABI - -var OffchainAggregatorEventsMockBin = OffchainAggregatorEventsMockMetaData.Bin - -func DeployOffchainAggregatorEventsMock(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *OffchainAggregatorEventsMock, error) { - parsed, err := OffchainAggregatorEventsMockMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(OffchainAggregatorEventsMockBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &OffchainAggregatorEventsMock{OffchainAggregatorEventsMockCaller: OffchainAggregatorEventsMockCaller{contract: contract}, OffchainAggregatorEventsMockTransactor: OffchainAggregatorEventsMockTransactor{contract: contract}, OffchainAggregatorEventsMockFilterer: OffchainAggregatorEventsMockFilterer{contract: contract}}, nil -} - -type OffchainAggregatorEventsMock struct { - address common.Address - abi abi.ABI - OffchainAggregatorEventsMockCaller - OffchainAggregatorEventsMockTransactor - OffchainAggregatorEventsMockFilterer -} - -type OffchainAggregatorEventsMockCaller struct { - contract *bind.BoundContract -} - -type OffchainAggregatorEventsMockTransactor struct { - contract *bind.BoundContract -} - -type OffchainAggregatorEventsMockFilterer struct { - contract *bind.BoundContract -} - -type OffchainAggregatorEventsMockSession struct { - Contract *OffchainAggregatorEventsMock - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type OffchainAggregatorEventsMockCallerSession struct { - Contract *OffchainAggregatorEventsMockCaller - CallOpts bind.CallOpts -} - -type OffchainAggregatorEventsMockTransactorSession struct { - Contract *OffchainAggregatorEventsMockTransactor - TransactOpts bind.TransactOpts -} - -type OffchainAggregatorEventsMockRaw struct { - Contract *OffchainAggregatorEventsMock -} - -type OffchainAggregatorEventsMockCallerRaw struct { - Contract *OffchainAggregatorEventsMockCaller -} - -type OffchainAggregatorEventsMockTransactorRaw struct { - Contract *OffchainAggregatorEventsMockTransactor -} - -func NewOffchainAggregatorEventsMock(address common.Address, backend bind.ContractBackend) (*OffchainAggregatorEventsMock, error) { - abi, err := abi.JSON(strings.NewReader(OffchainAggregatorEventsMockABI)) - if err != nil { - return nil, err - } - contract, err := bindOffchainAggregatorEventsMock(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMock{address: address, abi: abi, OffchainAggregatorEventsMockCaller: OffchainAggregatorEventsMockCaller{contract: contract}, OffchainAggregatorEventsMockTransactor: OffchainAggregatorEventsMockTransactor{contract: contract}, OffchainAggregatorEventsMockFilterer: OffchainAggregatorEventsMockFilterer{contract: contract}}, nil -} - -func NewOffchainAggregatorEventsMockCaller(address common.Address, caller bind.ContractCaller) (*OffchainAggregatorEventsMockCaller, error) { - contract, err := bindOffchainAggregatorEventsMock(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockCaller{contract: contract}, nil -} - -func NewOffchainAggregatorEventsMockTransactor(address common.Address, transactor bind.ContractTransactor) (*OffchainAggregatorEventsMockTransactor, error) { - contract, err := bindOffchainAggregatorEventsMock(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockTransactor{contract: contract}, nil -} - -func NewOffchainAggregatorEventsMockFilterer(address common.Address, filterer bind.ContractFilterer) (*OffchainAggregatorEventsMockFilterer, error) { - contract, err := bindOffchainAggregatorEventsMock(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockFilterer{contract: contract}, nil -} - -func bindOffchainAggregatorEventsMock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := OffchainAggregatorEventsMockMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _OffchainAggregatorEventsMock.Contract.OffchainAggregatorEventsMockCaller.contract.Call(opts, result, method, params...) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.OffchainAggregatorEventsMockTransactor.contract.Transfer(opts) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.OffchainAggregatorEventsMockTransactor.contract.Transact(opts, method, params...) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _OffchainAggregatorEventsMock.Contract.contract.Call(opts, result, method, params...) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.contract.Transfer(opts) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.contract.Transact(opts, method, params...) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitAnswerUpdated(opts *bind.TransactOpts, current *big.Int, roundId *big.Int, updatedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitAnswerUpdated", current, roundId, updatedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitAnswerUpdated(current *big.Int, roundId *big.Int, updatedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitAnswerUpdated(&_OffchainAggregatorEventsMock.TransactOpts, current, roundId, updatedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitAnswerUpdated(current *big.Int, roundId *big.Int, updatedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitAnswerUpdated(&_OffchainAggregatorEventsMock.TransactOpts, current, roundId, updatedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitBillingAccessControllerSet(opts *bind.TransactOpts, old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitBillingAccessControllerSet", old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitBillingAccessControllerSet(old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitBillingAccessControllerSet(&_OffchainAggregatorEventsMock.TransactOpts, old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitBillingAccessControllerSet(old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitBillingAccessControllerSet(&_OffchainAggregatorEventsMock.TransactOpts, old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitBillingSet(opts *bind.TransactOpts, maximumGasPrice uint32, reasonableGasPrice uint32, microLinkPerEth uint32, linkGweiPerObservation uint32, linkGweiPerTransmission uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitBillingSet", maximumGasPrice, reasonableGasPrice, microLinkPerEth, linkGweiPerObservation, linkGweiPerTransmission) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitBillingSet(maximumGasPrice uint32, reasonableGasPrice uint32, microLinkPerEth uint32, linkGweiPerObservation uint32, linkGweiPerTransmission uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitBillingSet(&_OffchainAggregatorEventsMock.TransactOpts, maximumGasPrice, reasonableGasPrice, microLinkPerEth, linkGweiPerObservation, linkGweiPerTransmission) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitBillingSet(maximumGasPrice uint32, reasonableGasPrice uint32, microLinkPerEth uint32, linkGweiPerObservation uint32, linkGweiPerTransmission uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitBillingSet(&_OffchainAggregatorEventsMock.TransactOpts, maximumGasPrice, reasonableGasPrice, microLinkPerEth, linkGweiPerObservation, linkGweiPerTransmission) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitConfigSet(opts *bind.TransactOpts, previousConfigBlockNumber uint32, configCount uint64, signers []common.Address, transmitters []common.Address, threshold uint8, encodedConfigVersion uint64, encoded []byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitConfigSet", previousConfigBlockNumber, configCount, signers, transmitters, threshold, encodedConfigVersion, encoded) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitConfigSet(previousConfigBlockNumber uint32, configCount uint64, signers []common.Address, transmitters []common.Address, threshold uint8, encodedConfigVersion uint64, encoded []byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitConfigSet(&_OffchainAggregatorEventsMock.TransactOpts, previousConfigBlockNumber, configCount, signers, transmitters, threshold, encodedConfigVersion, encoded) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitConfigSet(previousConfigBlockNumber uint32, configCount uint64, signers []common.Address, transmitters []common.Address, threshold uint8, encodedConfigVersion uint64, encoded []byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitConfigSet(&_OffchainAggregatorEventsMock.TransactOpts, previousConfigBlockNumber, configCount, signers, transmitters, threshold, encodedConfigVersion, encoded) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitLinkTokenSet(opts *bind.TransactOpts, _oldLinkToken common.Address, _newLinkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitLinkTokenSet", _oldLinkToken, _newLinkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitLinkTokenSet(_oldLinkToken common.Address, _newLinkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitLinkTokenSet(&_OffchainAggregatorEventsMock.TransactOpts, _oldLinkToken, _newLinkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitLinkTokenSet(_oldLinkToken common.Address, _newLinkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitLinkTokenSet(&_OffchainAggregatorEventsMock.TransactOpts, _oldLinkToken, _newLinkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitNewRound(opts *bind.TransactOpts, roundId *big.Int, startedBy common.Address, startedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitNewRound", roundId, startedBy, startedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitNewRound(roundId *big.Int, startedBy common.Address, startedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitNewRound(&_OffchainAggregatorEventsMock.TransactOpts, roundId, startedBy, startedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitNewRound(roundId *big.Int, startedBy common.Address, startedAt *big.Int) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitNewRound(&_OffchainAggregatorEventsMock.TransactOpts, roundId, startedBy, startedAt) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitNewTransmission(opts *bind.TransactOpts, aggregatorRoundId uint32, answer *big.Int, transmitter common.Address, observations []*big.Int, observers []byte, rawReportContext [32]byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitNewTransmission", aggregatorRoundId, answer, transmitter, observations, observers, rawReportContext) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitNewTransmission(aggregatorRoundId uint32, answer *big.Int, transmitter common.Address, observations []*big.Int, observers []byte, rawReportContext [32]byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitNewTransmission(&_OffchainAggregatorEventsMock.TransactOpts, aggregatorRoundId, answer, transmitter, observations, observers, rawReportContext) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitNewTransmission(aggregatorRoundId uint32, answer *big.Int, transmitter common.Address, observations []*big.Int, observers []byte, rawReportContext [32]byte) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitNewTransmission(&_OffchainAggregatorEventsMock.TransactOpts, aggregatorRoundId, answer, transmitter, observations, observers, rawReportContext) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitOraclePaid(opts *bind.TransactOpts, transmitter common.Address, payee common.Address, amount *big.Int, linkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitOraclePaid", transmitter, payee, amount, linkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitOraclePaid(transmitter common.Address, payee common.Address, amount *big.Int, linkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOraclePaid(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, payee, amount, linkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitOraclePaid(transmitter common.Address, payee common.Address, amount *big.Int, linkToken common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOraclePaid(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, payee, amount, linkToken) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitOwnershipTransferRequested(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitOwnershipTransferRequested", from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitOwnershipTransferRequested(from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOwnershipTransferRequested(&_OffchainAggregatorEventsMock.TransactOpts, from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitOwnershipTransferRequested(from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOwnershipTransferRequested(&_OffchainAggregatorEventsMock.TransactOpts, from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitOwnershipTransferred(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitOwnershipTransferred", from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitOwnershipTransferred(from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOwnershipTransferred(&_OffchainAggregatorEventsMock.TransactOpts, from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitOwnershipTransferred(from common.Address, to common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitOwnershipTransferred(&_OffchainAggregatorEventsMock.TransactOpts, from, to) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitPayeeshipTransferRequested(opts *bind.TransactOpts, transmitter common.Address, current common.Address, proposed common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitPayeeshipTransferRequested", transmitter, current, proposed) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitPayeeshipTransferRequested(transmitter common.Address, current common.Address, proposed common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitPayeeshipTransferRequested(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, current, proposed) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitPayeeshipTransferRequested(transmitter common.Address, current common.Address, proposed common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitPayeeshipTransferRequested(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, current, proposed) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitPayeeshipTransferred(opts *bind.TransactOpts, transmitter common.Address, previous common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitPayeeshipTransferred", transmitter, previous, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitPayeeshipTransferred(transmitter common.Address, previous common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitPayeeshipTransferred(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, previous, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitPayeeshipTransferred(transmitter common.Address, previous common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitPayeeshipTransferred(&_OffchainAggregatorEventsMock.TransactOpts, transmitter, previous, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitRequesterAccessControllerSet(opts *bind.TransactOpts, old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitRequesterAccessControllerSet", old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitRequesterAccessControllerSet(old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitRequesterAccessControllerSet(&_OffchainAggregatorEventsMock.TransactOpts, old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitRequesterAccessControllerSet(old common.Address, current common.Address) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitRequesterAccessControllerSet(&_OffchainAggregatorEventsMock.TransactOpts, old, current) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitRoundRequested(opts *bind.TransactOpts, requester common.Address, configDigest [16]byte, epoch uint32, round uint8) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitRoundRequested", requester, configDigest, epoch, round) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitRoundRequested(requester common.Address, configDigest [16]byte, epoch uint32, round uint8) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitRoundRequested(&_OffchainAggregatorEventsMock.TransactOpts, requester, configDigest, epoch, round) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitRoundRequested(requester common.Address, configDigest [16]byte, epoch uint32, round uint8) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitRoundRequested(&_OffchainAggregatorEventsMock.TransactOpts, requester, configDigest, epoch, round) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactor) EmitValidatorConfigSet(opts *bind.TransactOpts, previousValidator common.Address, previousGasLimit uint32, currentValidator common.Address, currentGasLimit uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.contract.Transact(opts, "emitValidatorConfigSet", previousValidator, previousGasLimit, currentValidator, currentGasLimit) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockSession) EmitValidatorConfigSet(previousValidator common.Address, previousGasLimit uint32, currentValidator common.Address, currentGasLimit uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitValidatorConfigSet(&_OffchainAggregatorEventsMock.TransactOpts, previousValidator, previousGasLimit, currentValidator, currentGasLimit) -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockTransactorSession) EmitValidatorConfigSet(previousValidator common.Address, previousGasLimit uint32, currentValidator common.Address, currentGasLimit uint32) (*types.Transaction, error) { - return _OffchainAggregatorEventsMock.Contract.EmitValidatorConfigSet(&_OffchainAggregatorEventsMock.TransactOpts, previousValidator, previousGasLimit, currentValidator, currentGasLimit) -} - -type OffchainAggregatorEventsMockAnswerUpdatedIterator struct { - Event *OffchainAggregatorEventsMockAnswerUpdated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockAnswerUpdatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockAnswerUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockAnswerUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockAnswerUpdatedIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockAnswerUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockAnswerUpdated struct { - Current *big.Int - RoundId *big.Int - UpdatedAt *big.Int - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterAnswerUpdated(opts *bind.FilterOpts, current []*big.Int, roundId []*big.Int) (*OffchainAggregatorEventsMockAnswerUpdatedIterator, error) { - - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var roundIdRule []interface{} - for _, roundIdItem := range roundId { - roundIdRule = append(roundIdRule, roundIdItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "AnswerUpdated", currentRule, roundIdRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockAnswerUpdatedIterator{contract: _OffchainAggregatorEventsMock.contract, event: "AnswerUpdated", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchAnswerUpdated(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockAnswerUpdated, current []*big.Int, roundId []*big.Int) (event.Subscription, error) { - - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var roundIdRule []interface{} - for _, roundIdItem := range roundId { - roundIdRule = append(roundIdRule, roundIdItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "AnswerUpdated", currentRule, roundIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockAnswerUpdated) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "AnswerUpdated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseAnswerUpdated(log types.Log) (*OffchainAggregatorEventsMockAnswerUpdated, error) { - event := new(OffchainAggregatorEventsMockAnswerUpdated) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "AnswerUpdated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockBillingAccessControllerSetIterator struct { - Event *OffchainAggregatorEventsMockBillingAccessControllerSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockBillingAccessControllerSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockBillingAccessControllerSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockBillingAccessControllerSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockBillingAccessControllerSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockBillingAccessControllerSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockBillingAccessControllerSet struct { - Old common.Address - Current common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterBillingAccessControllerSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockBillingAccessControllerSetIterator, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "BillingAccessControllerSet") - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockBillingAccessControllerSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "BillingAccessControllerSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchBillingAccessControllerSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockBillingAccessControllerSet) (event.Subscription, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "BillingAccessControllerSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockBillingAccessControllerSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "BillingAccessControllerSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseBillingAccessControllerSet(log types.Log) (*OffchainAggregatorEventsMockBillingAccessControllerSet, error) { - event := new(OffchainAggregatorEventsMockBillingAccessControllerSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "BillingAccessControllerSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockBillingSetIterator struct { - Event *OffchainAggregatorEventsMockBillingSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockBillingSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockBillingSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockBillingSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockBillingSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockBillingSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockBillingSet struct { - MaximumGasPrice uint32 - ReasonableGasPrice uint32 - MicroLinkPerEth uint32 - LinkGweiPerObservation uint32 - LinkGweiPerTransmission uint32 - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterBillingSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockBillingSetIterator, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "BillingSet") - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockBillingSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "BillingSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchBillingSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockBillingSet) (event.Subscription, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "BillingSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockBillingSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "BillingSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseBillingSet(log types.Log) (*OffchainAggregatorEventsMockBillingSet, error) { - event := new(OffchainAggregatorEventsMockBillingSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "BillingSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockConfigSetIterator struct { - Event *OffchainAggregatorEventsMockConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockConfigSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockConfigSet struct { - PreviousConfigBlockNumber uint32 - ConfigCount uint64 - Signers []common.Address - Transmitters []common.Address - Threshold uint8 - EncodedConfigVersion uint64 - Encoded []byte - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterConfigSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockConfigSetIterator, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockConfigSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "ConfigSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchConfigSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockConfigSet) (event.Subscription, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "ConfigSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockConfigSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseConfigSet(log types.Log) (*OffchainAggregatorEventsMockConfigSet, error) { - event := new(OffchainAggregatorEventsMockConfigSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "ConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockLinkTokenSetIterator struct { - Event *OffchainAggregatorEventsMockLinkTokenSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockLinkTokenSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockLinkTokenSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockLinkTokenSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockLinkTokenSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockLinkTokenSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockLinkTokenSet struct { - OldLinkToken common.Address - NewLinkToken common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterLinkTokenSet(opts *bind.FilterOpts, _oldLinkToken []common.Address, _newLinkToken []common.Address) (*OffchainAggregatorEventsMockLinkTokenSetIterator, error) { - - var _oldLinkTokenRule []interface{} - for _, _oldLinkTokenItem := range _oldLinkToken { - _oldLinkTokenRule = append(_oldLinkTokenRule, _oldLinkTokenItem) - } - var _newLinkTokenRule []interface{} - for _, _newLinkTokenItem := range _newLinkToken { - _newLinkTokenRule = append(_newLinkTokenRule, _newLinkTokenItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "LinkTokenSet", _oldLinkTokenRule, _newLinkTokenRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockLinkTokenSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "LinkTokenSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchLinkTokenSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockLinkTokenSet, _oldLinkToken []common.Address, _newLinkToken []common.Address) (event.Subscription, error) { - - var _oldLinkTokenRule []interface{} - for _, _oldLinkTokenItem := range _oldLinkToken { - _oldLinkTokenRule = append(_oldLinkTokenRule, _oldLinkTokenItem) - } - var _newLinkTokenRule []interface{} - for _, _newLinkTokenItem := range _newLinkToken { - _newLinkTokenRule = append(_newLinkTokenRule, _newLinkTokenItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "LinkTokenSet", _oldLinkTokenRule, _newLinkTokenRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockLinkTokenSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "LinkTokenSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseLinkTokenSet(log types.Log) (*OffchainAggregatorEventsMockLinkTokenSet, error) { - event := new(OffchainAggregatorEventsMockLinkTokenSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "LinkTokenSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockNewRoundIterator struct { - Event *OffchainAggregatorEventsMockNewRound - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockNewRoundIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockNewRound) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockNewRound) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockNewRoundIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockNewRoundIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockNewRound struct { - RoundId *big.Int - StartedBy common.Address - StartedAt *big.Int - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterNewRound(opts *bind.FilterOpts, roundId []*big.Int, startedBy []common.Address) (*OffchainAggregatorEventsMockNewRoundIterator, error) { - - var roundIdRule []interface{} - for _, roundIdItem := range roundId { - roundIdRule = append(roundIdRule, roundIdItem) - } - var startedByRule []interface{} - for _, startedByItem := range startedBy { - startedByRule = append(startedByRule, startedByItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "NewRound", roundIdRule, startedByRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockNewRoundIterator{contract: _OffchainAggregatorEventsMock.contract, event: "NewRound", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchNewRound(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockNewRound, roundId []*big.Int, startedBy []common.Address) (event.Subscription, error) { - - var roundIdRule []interface{} - for _, roundIdItem := range roundId { - roundIdRule = append(roundIdRule, roundIdItem) - } - var startedByRule []interface{} - for _, startedByItem := range startedBy { - startedByRule = append(startedByRule, startedByItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "NewRound", roundIdRule, startedByRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockNewRound) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "NewRound", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseNewRound(log types.Log) (*OffchainAggregatorEventsMockNewRound, error) { - event := new(OffchainAggregatorEventsMockNewRound) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "NewRound", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockNewTransmissionIterator struct { - Event *OffchainAggregatorEventsMockNewTransmission - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockNewTransmissionIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockNewTransmission) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockNewTransmission) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockNewTransmissionIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockNewTransmissionIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockNewTransmission struct { - AggregatorRoundId uint32 - Answer *big.Int - Transmitter common.Address - Observations []*big.Int - Observers []byte - RawReportContext [32]byte - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterNewTransmission(opts *bind.FilterOpts, aggregatorRoundId []uint32) (*OffchainAggregatorEventsMockNewTransmissionIterator, error) { - - var aggregatorRoundIdRule []interface{} - for _, aggregatorRoundIdItem := range aggregatorRoundId { - aggregatorRoundIdRule = append(aggregatorRoundIdRule, aggregatorRoundIdItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "NewTransmission", aggregatorRoundIdRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockNewTransmissionIterator{contract: _OffchainAggregatorEventsMock.contract, event: "NewTransmission", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchNewTransmission(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockNewTransmission, aggregatorRoundId []uint32) (event.Subscription, error) { - - var aggregatorRoundIdRule []interface{} - for _, aggregatorRoundIdItem := range aggregatorRoundId { - aggregatorRoundIdRule = append(aggregatorRoundIdRule, aggregatorRoundIdItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "NewTransmission", aggregatorRoundIdRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockNewTransmission) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "NewTransmission", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseNewTransmission(log types.Log) (*OffchainAggregatorEventsMockNewTransmission, error) { - event := new(OffchainAggregatorEventsMockNewTransmission) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "NewTransmission", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockOraclePaidIterator struct { - Event *OffchainAggregatorEventsMockOraclePaid - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockOraclePaidIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOraclePaid) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOraclePaid) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockOraclePaidIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockOraclePaidIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockOraclePaid struct { - Transmitter common.Address - Payee common.Address - Amount *big.Int - LinkToken common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterOraclePaid(opts *bind.FilterOpts, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (*OffchainAggregatorEventsMockOraclePaidIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var payeeRule []interface{} - for _, payeeItem := range payee { - payeeRule = append(payeeRule, payeeItem) - } - - var linkTokenRule []interface{} - for _, linkTokenItem := range linkToken { - linkTokenRule = append(linkTokenRule, linkTokenItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "OraclePaid", transmitterRule, payeeRule, linkTokenRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockOraclePaidIterator{contract: _OffchainAggregatorEventsMock.contract, event: "OraclePaid", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchOraclePaid(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOraclePaid, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var payeeRule []interface{} - for _, payeeItem := range payee { - payeeRule = append(payeeRule, payeeItem) - } - - var linkTokenRule []interface{} - for _, linkTokenItem := range linkToken { - linkTokenRule = append(linkTokenRule, linkTokenItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "OraclePaid", transmitterRule, payeeRule, linkTokenRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockOraclePaid) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OraclePaid", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseOraclePaid(log types.Log) (*OffchainAggregatorEventsMockOraclePaid, error) { - event := new(OffchainAggregatorEventsMockOraclePaid) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OraclePaid", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockOwnershipTransferRequestedIterator struct { - Event *OffchainAggregatorEventsMockOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*OffchainAggregatorEventsMockOwnershipTransferRequestedIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockOwnershipTransferRequestedIterator{contract: _OffchainAggregatorEventsMock.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockOwnershipTransferRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseOwnershipTransferRequested(log types.Log) (*OffchainAggregatorEventsMockOwnershipTransferRequested, error) { - event := new(OffchainAggregatorEventsMockOwnershipTransferRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockOwnershipTransferredIterator struct { - Event *OffchainAggregatorEventsMockOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*OffchainAggregatorEventsMockOwnershipTransferredIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockOwnershipTransferredIterator{contract: _OffchainAggregatorEventsMock.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockOwnershipTransferred) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseOwnershipTransferred(log types.Log) (*OffchainAggregatorEventsMockOwnershipTransferred, error) { - event := new(OffchainAggregatorEventsMockOwnershipTransferred) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator struct { - Event *OffchainAggregatorEventsMockPayeeshipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockPayeeshipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockPayeeshipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockPayeeshipTransferRequested struct { - Transmitter common.Address - Current common.Address - Proposed common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterPayeeshipTransferRequested(opts *bind.FilterOpts, transmitter []common.Address, current []common.Address, proposed []common.Address) (*OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var proposedRule []interface{} - for _, proposedItem := range proposed { - proposedRule = append(proposedRule, proposedItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "PayeeshipTransferRequested", transmitterRule, currentRule, proposedRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator{contract: _OffchainAggregatorEventsMock.contract, event: "PayeeshipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchPayeeshipTransferRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockPayeeshipTransferRequested, transmitter []common.Address, current []common.Address, proposed []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - var proposedRule []interface{} - for _, proposedItem := range proposed { - proposedRule = append(proposedRule, proposedItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "PayeeshipTransferRequested", transmitterRule, currentRule, proposedRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockPayeeshipTransferRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "PayeeshipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParsePayeeshipTransferRequested(log types.Log) (*OffchainAggregatorEventsMockPayeeshipTransferRequested, error) { - event := new(OffchainAggregatorEventsMockPayeeshipTransferRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "PayeeshipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockPayeeshipTransferredIterator struct { - Event *OffchainAggregatorEventsMockPayeeshipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockPayeeshipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockPayeeshipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferredIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockPayeeshipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockPayeeshipTransferred struct { - Transmitter common.Address - Previous common.Address - Current common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterPayeeshipTransferred(opts *bind.FilterOpts, transmitter []common.Address, previous []common.Address, current []common.Address) (*OffchainAggregatorEventsMockPayeeshipTransferredIterator, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var previousRule []interface{} - for _, previousItem := range previous { - previousRule = append(previousRule, previousItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "PayeeshipTransferred", transmitterRule, previousRule, currentRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockPayeeshipTransferredIterator{contract: _OffchainAggregatorEventsMock.contract, event: "PayeeshipTransferred", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchPayeeshipTransferred(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockPayeeshipTransferred, transmitter []common.Address, previous []common.Address, current []common.Address) (event.Subscription, error) { - - var transmitterRule []interface{} - for _, transmitterItem := range transmitter { - transmitterRule = append(transmitterRule, transmitterItem) - } - var previousRule []interface{} - for _, previousItem := range previous { - previousRule = append(previousRule, previousItem) - } - var currentRule []interface{} - for _, currentItem := range current { - currentRule = append(currentRule, currentItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "PayeeshipTransferred", transmitterRule, previousRule, currentRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockPayeeshipTransferred) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "PayeeshipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParsePayeeshipTransferred(log types.Log) (*OffchainAggregatorEventsMockPayeeshipTransferred, error) { - event := new(OffchainAggregatorEventsMockPayeeshipTransferred) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "PayeeshipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockRequesterAccessControllerSetIterator struct { - Event *OffchainAggregatorEventsMockRequesterAccessControllerSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockRequesterAccessControllerSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockRequesterAccessControllerSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockRequesterAccessControllerSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockRequesterAccessControllerSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockRequesterAccessControllerSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockRequesterAccessControllerSet struct { - Old common.Address - Current common.Address - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterRequesterAccessControllerSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockRequesterAccessControllerSetIterator, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "RequesterAccessControllerSet") - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockRequesterAccessControllerSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "RequesterAccessControllerSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchRequesterAccessControllerSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockRequesterAccessControllerSet) (event.Subscription, error) { - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "RequesterAccessControllerSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockRequesterAccessControllerSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "RequesterAccessControllerSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseRequesterAccessControllerSet(log types.Log) (*OffchainAggregatorEventsMockRequesterAccessControllerSet, error) { - event := new(OffchainAggregatorEventsMockRequesterAccessControllerSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "RequesterAccessControllerSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockRoundRequestedIterator struct { - Event *OffchainAggregatorEventsMockRoundRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockRoundRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockRoundRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockRoundRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockRoundRequestedIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockRoundRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockRoundRequested struct { - Requester common.Address - ConfigDigest [16]byte - Epoch uint32 - Round uint8 - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterRoundRequested(opts *bind.FilterOpts, requester []common.Address) (*OffchainAggregatorEventsMockRoundRequestedIterator, error) { - - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "RoundRequested", requesterRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockRoundRequestedIterator{contract: _OffchainAggregatorEventsMock.contract, event: "RoundRequested", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchRoundRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockRoundRequested, requester []common.Address) (event.Subscription, error) { - - var requesterRule []interface{} - for _, requesterItem := range requester { - requesterRule = append(requesterRule, requesterItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "RoundRequested", requesterRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockRoundRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "RoundRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseRoundRequested(log types.Log) (*OffchainAggregatorEventsMockRoundRequested, error) { - event := new(OffchainAggregatorEventsMockRoundRequested) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "RoundRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type OffchainAggregatorEventsMockValidatorConfigSetIterator struct { - Event *OffchainAggregatorEventsMockValidatorConfigSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *OffchainAggregatorEventsMockValidatorConfigSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockValidatorConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(OffchainAggregatorEventsMockValidatorConfigSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *OffchainAggregatorEventsMockValidatorConfigSetIterator) Error() error { - return it.fail -} - -func (it *OffchainAggregatorEventsMockValidatorConfigSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type OffchainAggregatorEventsMockValidatorConfigSet struct { - PreviousValidator common.Address - PreviousGasLimit uint32 - CurrentValidator common.Address - CurrentGasLimit uint32 - Raw types.Log -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) FilterValidatorConfigSet(opts *bind.FilterOpts, previousValidator []common.Address, currentValidator []common.Address) (*OffchainAggregatorEventsMockValidatorConfigSetIterator, error) { - - var previousValidatorRule []interface{} - for _, previousValidatorItem := range previousValidator { - previousValidatorRule = append(previousValidatorRule, previousValidatorItem) - } - - var currentValidatorRule []interface{} - for _, currentValidatorItem := range currentValidator { - currentValidatorRule = append(currentValidatorRule, currentValidatorItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.FilterLogs(opts, "ValidatorConfigSet", previousValidatorRule, currentValidatorRule) - if err != nil { - return nil, err - } - return &OffchainAggregatorEventsMockValidatorConfigSetIterator{contract: _OffchainAggregatorEventsMock.contract, event: "ValidatorConfigSet", logs: logs, sub: sub}, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) WatchValidatorConfigSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockValidatorConfigSet, previousValidator []common.Address, currentValidator []common.Address) (event.Subscription, error) { - - var previousValidatorRule []interface{} - for _, previousValidatorItem := range previousValidator { - previousValidatorRule = append(previousValidatorRule, previousValidatorItem) - } - - var currentValidatorRule []interface{} - for _, currentValidatorItem := range currentValidator { - currentValidatorRule = append(currentValidatorRule, currentValidatorItem) - } - - logs, sub, err := _OffchainAggregatorEventsMock.contract.WatchLogs(opts, "ValidatorConfigSet", previousValidatorRule, currentValidatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(OffchainAggregatorEventsMockValidatorConfigSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "ValidatorConfigSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMockFilterer) ParseValidatorConfigSet(log types.Log) (*OffchainAggregatorEventsMockValidatorConfigSet, error) { - event := new(OffchainAggregatorEventsMockValidatorConfigSet) - if err := _OffchainAggregatorEventsMock.contract.UnpackLog(event, "ValidatorConfigSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMock) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _OffchainAggregatorEventsMock.abi.Events["AnswerUpdated"].ID: - return _OffchainAggregatorEventsMock.ParseAnswerUpdated(log) - case _OffchainAggregatorEventsMock.abi.Events["BillingAccessControllerSet"].ID: - return _OffchainAggregatorEventsMock.ParseBillingAccessControllerSet(log) - case _OffchainAggregatorEventsMock.abi.Events["BillingSet"].ID: - return _OffchainAggregatorEventsMock.ParseBillingSet(log) - case _OffchainAggregatorEventsMock.abi.Events["ConfigSet"].ID: - return _OffchainAggregatorEventsMock.ParseConfigSet(log) - case _OffchainAggregatorEventsMock.abi.Events["LinkTokenSet"].ID: - return _OffchainAggregatorEventsMock.ParseLinkTokenSet(log) - case _OffchainAggregatorEventsMock.abi.Events["NewRound"].ID: - return _OffchainAggregatorEventsMock.ParseNewRound(log) - case _OffchainAggregatorEventsMock.abi.Events["NewTransmission"].ID: - return _OffchainAggregatorEventsMock.ParseNewTransmission(log) - case _OffchainAggregatorEventsMock.abi.Events["OraclePaid"].ID: - return _OffchainAggregatorEventsMock.ParseOraclePaid(log) - case _OffchainAggregatorEventsMock.abi.Events["OwnershipTransferRequested"].ID: - return _OffchainAggregatorEventsMock.ParseOwnershipTransferRequested(log) - case _OffchainAggregatorEventsMock.abi.Events["OwnershipTransferred"].ID: - return _OffchainAggregatorEventsMock.ParseOwnershipTransferred(log) - case _OffchainAggregatorEventsMock.abi.Events["PayeeshipTransferRequested"].ID: - return _OffchainAggregatorEventsMock.ParsePayeeshipTransferRequested(log) - case _OffchainAggregatorEventsMock.abi.Events["PayeeshipTransferred"].ID: - return _OffchainAggregatorEventsMock.ParsePayeeshipTransferred(log) - case _OffchainAggregatorEventsMock.abi.Events["RequesterAccessControllerSet"].ID: - return _OffchainAggregatorEventsMock.ParseRequesterAccessControllerSet(log) - case _OffchainAggregatorEventsMock.abi.Events["RoundRequested"].ID: - return _OffchainAggregatorEventsMock.ParseRoundRequested(log) - case _OffchainAggregatorEventsMock.abi.Events["ValidatorConfigSet"].ID: - return _OffchainAggregatorEventsMock.ParseValidatorConfigSet(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (OffchainAggregatorEventsMockAnswerUpdated) Topic() common.Hash { - return common.HexToHash("0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f") -} - -func (OffchainAggregatorEventsMockBillingAccessControllerSet) Topic() common.Hash { - return common.HexToHash("0x793cb73064f3c8cde7e187ae515511e6e56d1ee89bf08b82fa60fb70f8d48912") -} - -func (OffchainAggregatorEventsMockBillingSet) Topic() common.Hash { - return common.HexToHash("0xd0d9486a2c673e2a4b57fc82e4c8a556b3e2b82dd5db07e2c04a920ca0f469b6") -} - -func (OffchainAggregatorEventsMockConfigSet) Topic() common.Hash { - return common.HexToHash("0x25d719d88a4512dd76c7442b910a83360845505894eb444ef299409e180f8fb9") -} - -func (OffchainAggregatorEventsMockLinkTokenSet) Topic() common.Hash { - return common.HexToHash("0x4966a50c93f855342ccf6c5c0d358b85b91335b2acedc7da0932f691f351711a") -} - -func (OffchainAggregatorEventsMockNewRound) Topic() common.Hash { - return common.HexToHash("0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271") -} - -func (OffchainAggregatorEventsMockNewTransmission) Topic() common.Hash { - return common.HexToHash("0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451") -} - -func (OffchainAggregatorEventsMockOraclePaid) Topic() common.Hash { - return common.HexToHash("0xd0b1dac935d85bd54cf0a33b0d41d39f8cf53a968465fc7ea2377526b8ac712c") -} - -func (OffchainAggregatorEventsMockOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (OffchainAggregatorEventsMockOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (OffchainAggregatorEventsMockPayeeshipTransferRequested) Topic() common.Hash { - return common.HexToHash("0x84f7c7c80bb8ed2279b4aab5f61cd05e6374073d38f46d7f32de8c30e9e38367") -} - -func (OffchainAggregatorEventsMockPayeeshipTransferred) Topic() common.Hash { - return common.HexToHash("0x78af32efdcad432315431e9b03d27e6cd98fb79c405fdc5af7c1714d9c0f75b3") -} - -func (OffchainAggregatorEventsMockRequesterAccessControllerSet) Topic() common.Hash { - return common.HexToHash("0x27b89aede8b560578baaa25ee5ce3852c5eecad1e114b941bbd89e1eb4bae634") -} - -func (OffchainAggregatorEventsMockRoundRequested) Topic() common.Hash { - return common.HexToHash("0x3ea16a923ff4b1df6526e854c9e3a995c43385d70e73359e10623c74f0b52037") -} - -func (OffchainAggregatorEventsMockValidatorConfigSet) Topic() common.Hash { - return common.HexToHash("0xb04e3a37abe9c0fcdfebdeae019a8e2b12ddf53f5d55ffb0caccc1bedaca1541") -} - -func (_OffchainAggregatorEventsMock *OffchainAggregatorEventsMock) Address() common.Address { - return _OffchainAggregatorEventsMock.address -} - -type OffchainAggregatorEventsMockInterface interface { - EmitAnswerUpdated(opts *bind.TransactOpts, current *big.Int, roundId *big.Int, updatedAt *big.Int) (*types.Transaction, error) - - EmitBillingAccessControllerSet(opts *bind.TransactOpts, old common.Address, current common.Address) (*types.Transaction, error) - - EmitBillingSet(opts *bind.TransactOpts, maximumGasPrice uint32, reasonableGasPrice uint32, microLinkPerEth uint32, linkGweiPerObservation uint32, linkGweiPerTransmission uint32) (*types.Transaction, error) - - EmitConfigSet(opts *bind.TransactOpts, previousConfigBlockNumber uint32, configCount uint64, signers []common.Address, transmitters []common.Address, threshold uint8, encodedConfigVersion uint64, encoded []byte) (*types.Transaction, error) - - EmitLinkTokenSet(opts *bind.TransactOpts, _oldLinkToken common.Address, _newLinkToken common.Address) (*types.Transaction, error) - - EmitNewRound(opts *bind.TransactOpts, roundId *big.Int, startedBy common.Address, startedAt *big.Int) (*types.Transaction, error) - - EmitNewTransmission(opts *bind.TransactOpts, aggregatorRoundId uint32, answer *big.Int, transmitter common.Address, observations []*big.Int, observers []byte, rawReportContext [32]byte) (*types.Transaction, error) - - EmitOraclePaid(opts *bind.TransactOpts, transmitter common.Address, payee common.Address, amount *big.Int, linkToken common.Address) (*types.Transaction, error) - - EmitOwnershipTransferRequested(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) - - EmitOwnershipTransferred(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) - - EmitPayeeshipTransferRequested(opts *bind.TransactOpts, transmitter common.Address, current common.Address, proposed common.Address) (*types.Transaction, error) - - EmitPayeeshipTransferred(opts *bind.TransactOpts, transmitter common.Address, previous common.Address, current common.Address) (*types.Transaction, error) - - EmitRequesterAccessControllerSet(opts *bind.TransactOpts, old common.Address, current common.Address) (*types.Transaction, error) - - EmitRoundRequested(opts *bind.TransactOpts, requester common.Address, configDigest [16]byte, epoch uint32, round uint8) (*types.Transaction, error) - - EmitValidatorConfigSet(opts *bind.TransactOpts, previousValidator common.Address, previousGasLimit uint32, currentValidator common.Address, currentGasLimit uint32) (*types.Transaction, error) - - FilterAnswerUpdated(opts *bind.FilterOpts, current []*big.Int, roundId []*big.Int) (*OffchainAggregatorEventsMockAnswerUpdatedIterator, error) - - WatchAnswerUpdated(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockAnswerUpdated, current []*big.Int, roundId []*big.Int) (event.Subscription, error) - - ParseAnswerUpdated(log types.Log) (*OffchainAggregatorEventsMockAnswerUpdated, error) - - FilterBillingAccessControllerSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockBillingAccessControllerSetIterator, error) - - WatchBillingAccessControllerSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockBillingAccessControllerSet) (event.Subscription, error) - - ParseBillingAccessControllerSet(log types.Log) (*OffchainAggregatorEventsMockBillingAccessControllerSet, error) - - FilterBillingSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockBillingSetIterator, error) - - WatchBillingSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockBillingSet) (event.Subscription, error) - - ParseBillingSet(log types.Log) (*OffchainAggregatorEventsMockBillingSet, error) - - FilterConfigSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockConfigSetIterator, error) - - WatchConfigSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockConfigSet) (event.Subscription, error) - - ParseConfigSet(log types.Log) (*OffchainAggregatorEventsMockConfigSet, error) - - FilterLinkTokenSet(opts *bind.FilterOpts, _oldLinkToken []common.Address, _newLinkToken []common.Address) (*OffchainAggregatorEventsMockLinkTokenSetIterator, error) - - WatchLinkTokenSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockLinkTokenSet, _oldLinkToken []common.Address, _newLinkToken []common.Address) (event.Subscription, error) - - ParseLinkTokenSet(log types.Log) (*OffchainAggregatorEventsMockLinkTokenSet, error) - - FilterNewRound(opts *bind.FilterOpts, roundId []*big.Int, startedBy []common.Address) (*OffchainAggregatorEventsMockNewRoundIterator, error) - - WatchNewRound(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockNewRound, roundId []*big.Int, startedBy []common.Address) (event.Subscription, error) - - ParseNewRound(log types.Log) (*OffchainAggregatorEventsMockNewRound, error) - - FilterNewTransmission(opts *bind.FilterOpts, aggregatorRoundId []uint32) (*OffchainAggregatorEventsMockNewTransmissionIterator, error) - - WatchNewTransmission(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockNewTransmission, aggregatorRoundId []uint32) (event.Subscription, error) - - ParseNewTransmission(log types.Log) (*OffchainAggregatorEventsMockNewTransmission, error) - - FilterOraclePaid(opts *bind.FilterOpts, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (*OffchainAggregatorEventsMockOraclePaidIterator, error) - - WatchOraclePaid(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOraclePaid, transmitter []common.Address, payee []common.Address, linkToken []common.Address) (event.Subscription, error) - - ParseOraclePaid(log types.Log) (*OffchainAggregatorEventsMockOraclePaid, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*OffchainAggregatorEventsMockOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*OffchainAggregatorEventsMockOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*OffchainAggregatorEventsMockOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*OffchainAggregatorEventsMockOwnershipTransferred, error) - - FilterPayeeshipTransferRequested(opts *bind.FilterOpts, transmitter []common.Address, current []common.Address, proposed []common.Address) (*OffchainAggregatorEventsMockPayeeshipTransferRequestedIterator, error) - - WatchPayeeshipTransferRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockPayeeshipTransferRequested, transmitter []common.Address, current []common.Address, proposed []common.Address) (event.Subscription, error) - - ParsePayeeshipTransferRequested(log types.Log) (*OffchainAggregatorEventsMockPayeeshipTransferRequested, error) - - FilterPayeeshipTransferred(opts *bind.FilterOpts, transmitter []common.Address, previous []common.Address, current []common.Address) (*OffchainAggregatorEventsMockPayeeshipTransferredIterator, error) - - WatchPayeeshipTransferred(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockPayeeshipTransferred, transmitter []common.Address, previous []common.Address, current []common.Address) (event.Subscription, error) - - ParsePayeeshipTransferred(log types.Log) (*OffchainAggregatorEventsMockPayeeshipTransferred, error) - - FilterRequesterAccessControllerSet(opts *bind.FilterOpts) (*OffchainAggregatorEventsMockRequesterAccessControllerSetIterator, error) - - WatchRequesterAccessControllerSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockRequesterAccessControllerSet) (event.Subscription, error) - - ParseRequesterAccessControllerSet(log types.Log) (*OffchainAggregatorEventsMockRequesterAccessControllerSet, error) - - FilterRoundRequested(opts *bind.FilterOpts, requester []common.Address) (*OffchainAggregatorEventsMockRoundRequestedIterator, error) - - WatchRoundRequested(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockRoundRequested, requester []common.Address) (event.Subscription, error) - - ParseRoundRequested(log types.Log) (*OffchainAggregatorEventsMockRoundRequested, error) - - FilterValidatorConfigSet(opts *bind.FilterOpts, previousValidator []common.Address, currentValidator []common.Address) (*OffchainAggregatorEventsMockValidatorConfigSetIterator, error) - - WatchValidatorConfigSet(opts *bind.WatchOpts, sink chan<- *OffchainAggregatorEventsMockValidatorConfigSet, previousValidator []common.Address, currentValidator []common.Address) (event.Subscription, error) - - ParseValidatorConfigSet(log types.Log) (*OffchainAggregatorEventsMockValidatorConfigSet, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/integration-tests/contracts/ethereum/Staking.go b/integration-tests/contracts/ethereum/Staking.go deleted file mode 100644 index 8cbe770631c..00000000000 --- a/integration-tests/contracts/ethereum/Staking.go +++ /dev/null @@ -1,3117 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package ethereum - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription -) - -// StakingPoolConstructorParams is an auto generated low-level Go binding around an user-defined struct. -type StakingPoolConstructorParams struct { - LINKAddress common.Address - MonitoredFeed common.Address - InitialMaxPoolSize *big.Int - InitialMaxCommunityStakeAmount *big.Int - InitialMaxOperatorStakeAmount *big.Int - MinCommunityStakeAmount *big.Int - MinOperatorStakeAmount *big.Int - PriorityPeriodThreshold *big.Int - RegularPeriodThreshold *big.Int - MaxAlertingRewardAmount *big.Int - MinInitialOperatorCount *big.Int - MinRewardDuration *big.Int - SlashableDuration *big.Int - DelegationRateDenominator *big.Int -} - -// StakingMetaData contains all meta data concerning the Staking contract. -var StakingMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"components\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"LINKAddress\",\"type\":\"address\"},{\"internalType\":\"contractAggregatorV3Interface\",\"name\":\"monitoredFeed\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialMaxPoolSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialMaxCommunityStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialMaxOperatorStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minCommunityStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minOperatorStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"priorityPeriodThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"regularPeriodThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxAlertingRewardAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minInitialOperatorCount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minRewardDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashableDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"delegationRateDenominator\",\"type\":\"uint256\"}],\"internalType\":\"structStaking.PoolConstructorParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"}],\"name\":\"AlertAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlertInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CastError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"remainingAmount\",\"type\":\"uint256\"}],\"name\":\"ExcessiveStakeAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"ExistingStakeFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"currentOperatorsCount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minInitialOperatorsCount\",\"type\":\"uint256\"}],\"name\":\"InadequateInitialOperatorsCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"remainingPoolSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredPoolSize\",\"type\":\"uint256\"}],\"name\":\"InsufficientRemainingPoolSpace\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"requiredAmount\",\"type\":\"uint256\"}],\"name\":\"InsufficientStakeAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidDelegationRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMaxAlertingRewardAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxStakeAmount\",\"type\":\"uint256\"}],\"name\":\"InvalidMaxStakeAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMigrationTarget\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinCommunityStakeAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidMinOperatorStakeAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxPoolSize\",\"type\":\"uint256\"}],\"name\":\"InvalidPoolSize\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"currentStatus\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"requiredStatus\",\"type\":\"bool\"}],\"name\":\"InvalidPoolStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRegularPeriodThreshold\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MerkleRootNotSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"OperatorAlreadyExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"OperatorDoesNotExist\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"OperatorIsAssignedToFeed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"OperatorIsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RewardDurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderNotLinkToken\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"StakeNotFound\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"alerter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"AlertRaised\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"MerkleRootChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Migrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"MigrationTargetAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"MigrationTargetProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStake\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptMigrationTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"name\":\"addOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"addReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"alerter\",\"type\":\"address\"}],\"name\":\"canAlert\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newRate\",\"type\":\"uint256\"}],\"name\":\"changeRewardRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"conclude\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyUnpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAvailableReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getBaseReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getChainlinkToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommunityStakerLimits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegatesCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDelegationRateDenominator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getDelegationReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEarnedBaseRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEarnedDelegationRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeedOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxPoolSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMerkleRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMigrationTarget\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMonitoredFeed\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOperatorLimits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRewardTimestamps\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"getStake\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalCommunityStakedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDelegatedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalRemovedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalStakedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"proof\",\"type\":\"bytes32[]\"}],\"name\":\"hasAccess\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"}],\"name\":\"isOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"migrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onTokenTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"proposeMigrationTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"raiseAlert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"name\":\"removeOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"name\":\"setFeedOperators\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"setMerkleRoot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxPoolSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCommunityStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxOperatorStakeAmount\",\"type\":\"uint256\"}],\"name\":\"setPoolConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialRewardRate\",\"type\":\"uint256\"}],\"name\":\"start\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawRemovedStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawUnusedReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101e06040523480156200001257600080fd5b50604051620056cd380380620056cd833981016040819052620000359162000766565b33806000816200008c5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000bf57620000bf81620002ee565b50506001805460ff60a01b191690555080516001600160a01b0316620000f85760405163f6b2911f60e01b815260040160405180910390fd5b60208101516001600160a01b0316620001245760405163f6b2911f60e01b815260040160405180910390fd5b806101a001516000036200014b5760405163027953ef60e61b815260040160405180910390fd5b6000816101a0015164e8d4a510006200016591906200082b565b1115620001855760405163027953ef60e61b815260040160405180910390fd5b8060e0015181610100015111620001af576040516310919fb960e11b815260040160405180910390fd5b8060c00151600003620001d5576040516384dada8560e01b815260040160405180910390fd5b80608001518160c001511115620001ff576040516384dada8560e01b815260040160405180910390fd5b80606001518160a001511115620002295760405163941b857f60e01b815260040160405180910390fd5b80608001518161012001511115620002545760405163a9be3a0960e01b815260040160405180910390fd5b6200027f81604001518260600151836080015160026200039960201b6200208d17909392919060201c565b80516001600160a01b0390811660805260208201511660a090815260e08083015160c0908152610100808501519092526101208085015190925283015190528101516101409081528101516101609081528101516101809081528101516101a090815201516101c052620008a2565b336001600160a01b03821603620003485760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000083565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b82811115620003bf5760405163bc91aa3360e01b81526004810182905260240162000083565b60038401546001600160601b0316831015620003f257604051630f9e1c3b60e11b81526004810184905260240162000083565b60038401546c0100000000000000000000000090046001600160501b0316821015620004355760405163bc91aa3360e01b81526004810183905260240162000083565b6003840154600160b01b90046001600160501b03168110156200046f5760405163bc91aa3360e01b81526004810182905260240162000083565b60408051608081018252600286015460ff80821615158352610100820416602083018190526001600160601b036201000083048116948401859052600160701b9092049091166060830152909190620004ca90849062000864565b620004d6919062000886565b841015620004fb5760405163bc91aa3360e01b81526004810183905260240162000083565b60038501546001600160601b031684146200057c576200052684620006b760201b620023571760201c565b6003860180546001600160601b0319166001600160601b03929092169190911790556040518481527f7f4f497e086b2eb55f8a9885ba00d33399bbe0ebcb92ea092834386435a1b9c09060200160405180910390a15b60038501546c0100000000000000000000000090046001600160501b031683146200062157620005b783620006e660201b620023851760201c565b6003860180546001600160501b03929092166c0100000000000000000000000002600160601b600160b01b03199092169190911790556040518381527fb5f554e5ef00806bace1edbb84186512ebcefa2af7706085143f501f29314df79060200160405180910390a15b6003850154600160b01b90046001600160501b03168214620006b0576200065382620006e660201b620023851760201c565b6003860180546001600160501b0392909216600160b01b026001600160b01b039092169190911790556040518281527f816587cb2e773af4f3689a03d7520fabff3462605ded374b485b13994c0d7b529060200160405180910390a15b5050505050565b60006001600160601b03821115620006e25760405163408ba96f60e11b815260040160405180910390fd5b5090565b60006001600160501b03821115620006e25760405163408ba96f60e11b815260040160405180910390fd5b6040516101c081016001600160401b03811182821017156200074357634e487b7160e01b600052604160045260246000fd5b60405290565b80516001600160a01b03811681146200076157600080fd5b919050565b60006101c082840312156200077a57600080fd5b6200078462000711565b6200078f8362000749565b81526200079f6020840162000749565b602082015260408381015190820152606080840151908201526080808401519082015260a0808401519082015260c0808401519082015260e08084015190820152610100808401519082015261012080840151908201526101408084015190820152610160808401519082015261018080840151908201526101a0928301519281019290925250919050565b6000826200084957634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156200088157620008816200084e565b500290565b808201808211156200089c576200089c6200084e565b92915050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c051614cf5620009d8600039600081816103d8015281816112850152818161153d015281816126ec015281816135fb015261368e01526000611d80015260008181610c3301528181610cfa01526111d4015260006111090152600081816102b10152818161353001526135650152600081816104ea01528181611d5e01528181613227015261325c0152600081816139cc0152613a000152600081816116950152611c0501526000818161165a0152611bb90152600081816104ae015281816115b20152611aff01526000818161063b0152818161072b015281816108fa01528181610b8e01528181610fdf015281816111440152818161140b01528181611cc60152611e550152614cf56000f3fe608060405234801561001057600080fd5b50600436106102815760003560e01c80637a7664601161015d578063a07aea1c116100c9578063a07aea1c1461058f578063a4c0ed36146105a2578063a7a2f5aa146105b5578063b187bd26146105bd578063bfbd9b1b146105c5578063c1852f58146105d8578063d365a377146105eb578063da9c732f146105fe578063e0974ea514610606578063e5f929731461060e578063e937fdaa14610616578063ebdb56f31461061e578063f2fde38b1461062657600080fd5b80637a7664601461046d5780637cb64759146104805780637e1a3786146104935780638019e7d0146104a457806383db28a0146104ac57806387e900b1146104d25780638856398f146104e55780638932a90d1461051f5780638a44f337146105325780638da5cb5b146105455780638fb4b573146105565780639a109bc2146105695780639d0a38641461057c57600080fd5b80634a4e3bd5116101fc5780634a4e3bd5146103a257806351858e27146103aa57806359f01879146103b25780635aa6e013146103c65780635c975abb146103ce5780635e8b40d7146103d65780635fec60f8146103fc57806363b2c85a146104115780636d70f7ae14610424578063741040021461043757806374de4ec41461043f57806374f237c41461045257806379ba50971461046557600080fd5b8063049b2ca0146102865780630641bdd8146102ac5780630fbc8f5b146102f7578063165d35e114610308578063181f5a771461031d5780631a9d4c7c1461034c5780631ddb55521461035457806322f3e2d4146103655780632def66201461037d57806332e288501461038757806338adb6f014610392578063495906571461039a575b600080fd5b6004546201000090046001600160601b03165b6040519081526020015b60405180910390f35b6005547f000000000000000000000000000000000000000000000000000000000000000090600160601b90046001600160501b03165b604080519283526020830191909152016102a3565b6005546001600160601b0316610299565b610310610639565b6040516102a39190614432565b604080518082018252600d81526c05374616b696e6720302e312e3609c1b602082015290516102a3919061448c565b61029961065d565b600f546001600160a01b0316610310565b61036d610682565b60405190151581526020016102a3565b61038561069b565b005b60085460ff16610299565b6102996107cc565b601154610299565b6103856107d8565b6103856107ea565b6102e2600c54600b5463ffffffff90911691565b6103856107fa565b61036d610978565b7f0000000000000000000000000000000000000000000000000000000000000000610299565b610404610988565b6040516102a391906144e3565b61038561041f366004614512565b6109ed565b61036d610432366004614512565b610b3f565b610299610b52565b61038561044d36600461452d565b610b67565b61038561046036600461452d565b610c9f565b610385610d65565b61029961047b366004614512565b610e0f565b61038561048e36600461452d565b610e39565b6009546001600160501b0316610299565b600654610299565b7f0000000000000000000000000000000000000000000000000000000000000000610310565b6102996104e0366004614512565b610e76565b6005547f000000000000000000000000000000000000000000000000000000000000000090600160b01b90046001600160501b03166102e2565b61038561052d366004614546565b610f24565b6103856105403660046145b7565b6110aa565b6000546001600160a01b0316610310565b6103856105643660046145e3565b6110da565b610299610577366004614512565b611206565b61036d61058a36600461466e565b6112bb565b61038561059d366004614716565b611300565b6103856105b0366004614778565b611358565b610299611522565b61036d611561565b6103856105d3366004614716565b61156b565b61036d6105e6366004614512565b61157f565b6103856105f9366004614716565b6116dd565b610385611ac4565b610299611e2e565b610385611edf565b610385611f17565b610385611fd9565b610385610634366004614512565b612079565b7f000000000000000000000000000000000000000000000000000000000000000090565b600061067d61066c60026123af565b610674611522565b60079190612405565b905090565b60045460009060ff16801561067d575050600b54421090565b6106a3610682565b156106d057604051635185386160e11b815260016004820152600060248201526044015b60405180910390fd5b60008060006106de3361243b565b9250925092507f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00338484846040516107199493929190614826565b60405180910390a16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb338361075c8688614862565b6107669190614862565b6040518363ffffffff1660e01b8152600401610783929190614875565b6020604051808303816000875af11580156107a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c6919061488e565b50505050565b600061067d60026123af565b6107e06127af565b6107e8612802565b565b6107f26127af565b6107e8612847565b610802610682565b1561082a57604051635185386160e11b815260016004820152600060248201526044016106c7565b33600090815260026020526040812054600160701b90046001600160601b03169081900361086d5733604051637256ef3960e11b81526004016106c79190614432565b806002600401600082825461088291906148b0565b9091555050336000818152600260205260408082208054600160701b600160d01b0319169055517f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00926108db9290918591908190614826565b60405180910390a160405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906109319033908590600401614875565b6020604051808303816000875af1158015610950573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610974919061488e565b5050565b600154600160a01b900460ff1690565b606060026001018054806020026020016040519081016040528092919081815260200182805480156109e357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116109c5575b5050505050905090565b6109f56127af565b6001600160a01b0381163b1580610a1457506001600160a01b03811630145b80610a2c5750600d546001600160a01b038281169116145b80610a445750600f546001600160a01b038281169116145b80610abb57506040516301ffc9a760e01b8152635260769b60e11b60048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa158015610a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab9919061488e565b155b15610ad9576040516306cf420760e31b815260040160405180910390fd5b600f80546001600160a01b0319908116909155600d80549091166001600160a01b03831617905542600e556040517f5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad390610b34908390614432565b60405180910390a150565b6000610b4c60028361288a565b92915050565b600061067d610b5f611522565b6007906128a9565b610b6f6127af565b610b776128d8565b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90610bc7903390309086906004016148c3565b6020604051808303816000875af1158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a919061488e565b50600554610c6f906001600160601b0316610c2560026123af565b6009546001600160501b03167f0000000000000000000000000000000000000000000000000000000000000000610c5a611e2e565b610c62611522565b6007959493929190612907565b6040518181527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d90602001610b34565b610ca76127af565b610caf6128d8565b80600003610cbc57600080fd5b6000610cc6611522565b9050610cd3600782612a6c565b610cdd6007612adf565b600554610d2e906001600160601b0316610cf760026123af565b847f0000000000000000000000000000000000000000000000000000000000000000610d21611e2e565b6007949392919087612907565b6040518281527f1e3be2efa25bca5bff2215c7b30b31086e703d6aa7d9b9a1f8ba62c5291219ad9060200160405180910390a15050565b6001546001600160a01b03163314610db85760405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b60448201526064016106c7565b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b6001600160a01b03166000908152600260205260409020546201000090046001600160601b031690565b610e416127af565b60118190556040518181527f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c90602001610b34565b6001600160a01b03811660009081526002602090815260408083208151608081018352905460ff808216151580845261010083049091161515948301949094526001600160601b03620100008204811693830193909352600160701b9004909116606082015290610eea5750600092915050565b80604001516001600160601b0316600003610f085750600092915050565b610f1d83610f14611522565b60079190612ba2565b9392505050565b610f2c610682565b15610f5457604051635185386160e11b815260016004820152600060248201526044016106c7565b600f546001600160a01b0316610f7d576040516306cf420760e31b815260040160405180910390fd5b6000806000610f8b3361243b565b9250925092507f667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434338484848989604051610fca96959493929190614910565b60405180910390a1600f546001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691634000aea09116836110138688614862565b61101d9190614862565b33898960405160200161103293929190614950565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161105f93929190614975565b6020604051808303816000875af115801561107e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a2919061488e565b505050505050565b6110b26127af565b6110ba6128d8565b6110c7600284848461208d565b6110d583610c2560026123af565b505050565b6110e26127af565b60115461110257604051634fc5147960e11b815260040160405180910390fd5b61112d60027f0000000000000000000000000000000000000000000000000000000000000000612bdf565b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd9061117d903390309087906004016148c3565b6020604051808303816000875af115801561119c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c0919061488e565b50600554610974906001600160601b0316827f00000000000000000000000000000000000000000000000000000000000000006111fb611e2e565b600793929190612c5e565b6001600160a01b0381166000908152600260205260408120546201000090046001600160601b031680820361123e5750600092915050565b61124960028461288a565b1561125a57610f1d60078483612d6c565b6001600160a01b0383166000908152600760205260409020546001600160601b03166112b16112a9837f0000000000000000000000000000000000000000000000000000000000000000612d98565b600790612dae565b610f1d91906148b0565b6011546000906112cd57506001610b4c565b610f1d82601154856040516020016112e59190614432565b60405160208183030381529060405280519060200120612e5b565b6113086127af565b600c5463ffffffff16158015906113245750611322610682565b155b1561134c57604051635185386160e11b815260006004820152600160248201526044016106c7565b61097460028383612e71565b611360610639565b6001600160a01b0316336001600160a01b031614611391576040516309ad2a8760e31b815260040160405180910390fd5b6113996131a4565b6113a16128d8565b64e8d4a510008210156113ce57604051631d820b1760e01b815264e8d4a5100060048201526024016106c7565b60006113df64e8d4a51000846149b2565b90508015611487576113f181846148b0565b60405163a9059cbb60e01b81529093506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906114429087908590600401614875565b6020604051808303816000875af1158015611461573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611485919061488e565b505b61149260028561288a565b156114a6576114a184846131ec565b6107c6565b601154156115185781516000036114d057604051631decfebb60e31b815260040160405180910390fd5b6114fb828060200190518101906114e791906149c6565b601154866040516020016112e59190614432565b61151857604051631decfebb60e31b815260040160405180910390fd5b6107c684846134f9565b60045460009061067d906201000090046001600160601b03167f0000000000000000000000000000000000000000000000000000000000000000613797565b600061067d610978565b6115736127af565b610974600283836137a3565b600061158a82610e0f565b60000361159957506000919050565b6115a1610682565b6115ad57506000919050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801561160e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116329190614a6d565b50935050506001600160501b031691506010548203611655575060009392505050565b61167f7f000000000000000000000000000000000000000000000000000000000000000082614862565b421015611690575060009392505050565b6116ba7f000000000000000000000000000000000000000000000000000000000000000082614862565b42106116ca575060019392505050565b6116d560028561288a565b949350505050565b6116e56127af565b6116ed6128d8565b6117006116f8611522565b600790612a6c565b60005b81811015611a8457600083838381811061171f5761171f614abd565b90506020020160208101906117349190614512565b6001600160a01b0381166000908152600260209081526040918290208251608081018452905460ff808216151580845261010083049091161515938301939093526001600160601b03620100008204811694830194909452600160701b90049092166060830152919250906117be578160405163eac13dcd60e01b81526004016106c79190614432565b8060200151156117e3578160405163ded6031960e01b81526004016106c79190614432565b60408101516001600160601b03168015611a145761180861180384611206565b612357565b600a80546000906118239084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061186161180382611858600761393e565b6007919061396f565b600a805460009061187c9084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b031602179055506118ac61180384610e76565b600a8054600c906118ce908490600160601b90046001600160601b0316614ad3565b82546001600160601b039182166101009390930a928302919092021990911617905550600880546001919060009061190a90849060ff16614afa565b825460ff9182166101009390930a9283029190920219909116179055506001600160a01b0383166000908152600260205260408120805462010000600160701b031916905561195882612357565b600480549192508291600e9061197f908490600160701b90046001600160601b0316614ad3565b82546101009290920a6001600160601b038181021990931691831602179091556001600160a01b03861660009081526002602052604081208054600160701b600160d01b031916600160701b93861693840217905560068054929350916119e7908490614862565b9091555050506001600160a01b038316600090815260076020526040902080546001600160601b03191690555b6001600160a01b03831660009081526002602052604090819020805460ff19169055517f2360404a74478febece1a14f11275f22ada88d19ef96f7d785913010bfff447990611a669085908490614875565b60405180910390a15050508080611a7c90614b13565b915050611703565b50611a8e8161399d565b60048054600190611aa8908490610100900460ff16614afa565b92506101000a81548160ff021916908360ff1602179055505050565b611acc6128d8565b6000611ad733610e0f565b905080600003611afa57604051631decfebb60e31b815260040160405180910390fd5b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7f9190614a6d565b50935050506001600160501b031691506010548203611bb4576040516379aa9e1160e11b8152600481018390526024016106c7565b611bde7f000000000000000000000000000000000000000000000000000000000000000082614862565b421015611bfe57604051637e29e28560e11b815260040160405180910390fd5b6000611c2a7f000000000000000000000000000000000000000000000000000000000000000083614862565b42109050808015611c435750611c4160023361288a565b155b15611c6157604051637e29e28560e11b815260040160405180910390fd5b60108390556000611c7285836139c1565b90507fd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd338583604051611ca793929190614b2c565b60405180910390a160405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90611cfd9033908590600401614875565b6020604051808303816000875af1158015611d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d40919061488e565b506003805460408051602080840282018101909252828152611df7937f0000000000000000000000000000000000000000000000000000000000000000937f000000000000000000000000000000000000000000000000000000000000000093830182828015611dd957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611dbb575b50505050506002600001611deb611522565b60079493929190613a24565b600554611e27906001600160601b0316611e1160026123af565b6009546001600160501b03166000610c5a611e2e565b5050505050565b600654600090611e3e60026123af565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611e8a903090600401614432565b602060405180830381865afa158015611ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecb9190614b4d565b611ed591906148b0565b61067d91906148b0565b611ee76127af565b611eef6128d8565b611f0d611efc60026123af565b611f04611522565b60079190613ce0565b6107e86002613d12565b611f1f6127af565b600d546001600160a01b0316611f48576040516306cf420760e31b815260040160405180910390fd5b600e54611f589062093a80614862565b421015611f7857604051631decfebb60e31b815260040160405180910390fd5b600d8054600f80546001600160a01b0383166001600160a01b031991821681179092559091169091556040517ffa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd8491611fcf91614432565b60405180910390a1565b611fe16127af565b611fe9610682565b1561201157604051635185386160e11b815260016004820152600060248201526044016106c7565b600a546000906001600160601b03600160601b820481169116612032611e2e565b61203c91906148b0565b61204691906148b0565b90507f150a6ec0e6f4e9ddcaaaa1674f157d91165a42d60653016f87a9fc870a39f050816040516108db91815260200190565b6120816127af565b61208a81613d4a565b50565b828111156120b15760405163bc91aa3360e01b8152600481018290526024016106c7565b60038401546001600160601b03168310156120e257604051630f9e1c3b60e11b8152600481018490526024016106c7565b6003840154600160601b90046001600160501b031682101561211a5760405163bc91aa3360e01b8152600481018390526024016106c7565b6003840154600160b01b90046001600160501b03168110156121525760405163bc91aa3360e01b8152600481018290526024016106c7565b60408051608081018252600286015460ff80821615158352610100820416602083018190526001600160601b036201000083048116948401859052600160701b90920490911660608301529091906121ab908490614b66565b6121b59190614862565b8410156121d85760405163bc91aa3360e01b8152600481018390526024016106c7565b60038501546001600160601b0316841461224b576121f584612357565b6003860180546001600160601b0319166001600160601b03929092169190911790556040518481527f7f4f497e086b2eb55f8a9885ba00d33399bbe0ebcb92ea092834386435a1b9c09060200160405180910390a15b6003850154600160601b90046001600160501b031683146122d05761226f83612385565b6003860180546001600160501b0392909216600160601b02600160601b600160b01b03199092169190911790556040518381527fb5f554e5ef00806bace1edbb84186512ebcefa2af7706085143f501f29314df79060200160405180910390a15b6003850154600160b01b90046001600160501b03168214611e27576122f482612385565b6003860180546001600160501b0392909216600160b01b026001600160b01b039092169190911790556040518281527f816587cb2e773af4f3689a03d7520fabff3462605ded374b485b13994c0d7b529060200160405180910390a15050505050565b60006001600160601b038211156123815760405163408ba96f60e11b815260040160405180910390fd5b5090565b60006001600160501b038211156123815760405163408ba96f60e11b815260040160405180910390fd5b60408051608081018252600283015460ff8082161515835261010082041660208301526001600160601b036201000082048116938301849052600160701b9091041660608201819052600092610f1d9190614862565b60006124238461241584866148b0565b61241e8761393e565b61396f565b60038501546116d591906001600160601b03166148b0565b6001600160a01b03811660009081526002602090815260408083208151608081018352905460ff808216151583526101008204161515938201939093526001600160601b036201000084048116928201839052600160701b90930490921660608301528291829182036124c35784604051637256ef3960e11b81526004016106c79190614432565b60045460ff16156124ee576124d96116f8611522565b6124e36007612adf565b6004805460ff191690555b80511561268a57604081015160048054600e9061251c908490600160701b90046001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550600061256582604001516001600160601b0316876007613ded9092919063ffffffff16565b6001600160a01b03871660009081526007602052604081205460085492935090916125a8916001600160601b03600160601b9091048116916101009004166148b0565b6001600160a01b0388166000908152600260205260409020805462010000600160701b031916905590506125db82612357565b600a80546000906125f69084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061262381612357565b600a8054600c90612645908490600160601b90046001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555082604001518282826001600160601b031692509550955095505050506127a8565b6040810151600480546002906126b09084906201000090046001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550600061271961271083604001516001600160601b03167f0000000000000000000000000000000000000000000000000000000000000000612d98565b60079088613ded565b6001600160a01b0387166000908152600260205260409020805462010000600160701b0319169055905061274c81612357565b600a80546000906127679084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b031602179055508160400151816000826001600160601b0316925094509450945050505b9193909250565b6000546001600160a01b031633146107e85760405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b60448201526064016106c7565b61280a613e3b565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611fcf9190614432565b61284f6131a4565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861283a3390565b6001600160a01b03166000908152602091909152604090205460ff1690565b60006128b9838361241e8661393e565b6003840154610f1d9190600160601b90046001600160601b03166148b0565b6128e0610682565b6107e857604051635185386160e11b815260006004820152600160248201526044016106c7565b6000612914888784612405565b9050600061292289846128a9565b905060008161293184876148b0565b61293b91906148b0565b60028b01549091506001600160501b0316871461297e5761295b87612385565b60028b0180546001600160501b0319166001600160501b03929092169190911790555b600061298a8a89614b66565b61299964e8d4a5100084614b66565b6129a39190614b85565b9050868110156129c55760405162da056d60e81b815260040160405180910390fd5b6129e66129dc8c6129d6888d6148b0565b8461396f565b6118039086614862565b60038c0180546001600160601b0319166001600160601b0392909216919091179055612a20612a168c878461396f565b6118039085614862565b60038c0180546001600160601b0392909216600160601b02600160601b600160c01b0319909216919091179055612a578142614862565b8b600401819055505050505050505050505050565b612a796118038383613e86565b6001830180546001600160601b039290921661010002610100600160681b0319909216919091179055612ab3612aae83613f25565b613f35565b6001909201805463ffffffff93909316600160681b0263ffffffff60681b199093169290921790915550565b6000612aea82613f25565b6002830154909150612b2590612b0d90600160b01b900463ffffffff16836148b0565b600284015461180391906001600160501b0316614b66565b600283018054600a90612b49908490600160501b90046001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550612b7681613f35565b6002909201805463ffffffff93909316600160b01b0263ffffffff60b01b199093169290921790915550565b6001600160a01b038216600090815260208490526040812054600160601b90046001600160601b0316612bd58584613e86565b6116d591906148b0565b6002820154610100900460ff16811115612c2257600282015460405163e709379960e01b815261010090910460ff166004820152602481018290526044016106c7565b60028201805460ff191660011790556040517fded6ebf04e261e1eb2f3e3b268a2e6aee5b478c15b341eba5cf18b9bc80c2e6390600090a15050565b600585015463ffffffff1615612c7357600080fd5b612c7c83612385565b6002860180546001600160501b0319166001600160501b03929092169190911790556000612ca942613f35565b60058701805463ffffffff191663ffffffff831690811790915560018801805463ffffffff60681b1916600160681b830217905560028801805463ffffffff60b01b1916600160b01b9092029190911790559050612d0d8686600087878783612907565b60058601546004870154604080518781526020810186905263ffffffff9093169083015260608201527f125fc8494f786b470e3c39d0932a62e9e09e291ebd81ea19c57604f6d2b1d167906080015b60405180910390a1505050505050565b6001600160a01b0382166000908152602084905260408120546001600160601b0316612bd58584612dae565b6000612da48383613797565b610f1d90846148b0565b600080612dbf846004015442101590565b612de4576002840154612ddf90600160b01b900463ffffffff16426148b0565b612e05565b60028401546004850154612e0591600160b01b900463ffffffff16906148b0565b600285015490915064e8d4a5100090612e289083906001600160501b0316614b66565b6002860154612e479190600160501b90046001600160601b0316614862565b612e519085614b66565b6116d59190614b85565b600082612e688584613f5c565b14949350505050565b6003830154600090612e9390600160b01b90046001600160501b031683614b66565b90506000612ea085613fa9565b905080821115612ecd576040516335cf446b60e01b815260048101829052602481018390526044016106c7565b60005b8381101561315e57856000868684818110612eed57612eed614abd565b9050602002016020810190612f029190614512565b6001600160a01b0316815260208101919091526040016000205460ff1615612f6457848482818110612f3657612f36614abd565b9050602002016020810190612f4b9190614512565b604051625290b360e11b81526004016106c79190614432565b60008681878785818110612f7a57612f7a614abd565b9050602002016020810190612f8f9190614512565b6001600160a01b031681526020810191909152604001600020546201000090046001600160601b03161115612fff57848482818110612fd057612fd0614abd565b9050602002016020810190612fe59190614512565b60405163602d4d1160e01b81526004016106c79190614432565b6000868187878581811061301557613015614abd565b905060200201602081019061302a9190614512565b6001600160a01b03168152602081019190915260400160002054600160701b90046001600160601b0316111561309b5784848281811061306c5761306c614abd565b90506020020160208101906130819190614512565b604051631e8de2e760e21b81526004016106c79190614432565b60018660008787858181106130b2576130b2614abd565b90506020020160208101906130c79190614512565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d85858381811061312257613122614abd565b90506020020160208101906131379190614512565b6040516131449190614432565b60405180910390a18061315681614b13565b915050612ed0565b506131688361399d565b600286015461317f9190610100900460ff16614bb9565b6002909501805460ff969096166101000261ff00199096169590951790945550505050565b6131ac610978565b156107e85760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106c7565b6001600160a01b038216600090815260026020526040812080549091620100009091046001600160601b0316906132238483614862565b90507f000000000000000000000000000000000000000000000000000000000000000081101561328857604051631d820b1760e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526024016106c7565b600554600160b01b90046001600160501b0316808211156132c9576132ad83826148b0565b604051631728673b60e31b81526004016106c791815260200190565b826000036133b3576132dc6116f8611522565b60085460ff16600081900361334e57600854600a80546001600160601b03610100909304831692600c91613319918591600160601b900416614ad3565b82546001600160601b039182166101009390930a92830291909202199091161790555060088054610100600160681b03191690555b613359816001614bb9565b6008805460ff191660ff9290921691909117908190556001600160a01b03881660009081526007602052604090208054600160601b600160c01b0319166101009092046001600160601b0316600160601b02919091179055505b6133c1611803600787612dae565b6001600160a01b038716600090815260076020526040812080549091906133f29084906001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061341f85612357565b60048054600e90613441908490600160701b90046001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061347c85600060076140309092919063ffffffff16565b61348582612357565b6001600160a01b0387166000908152600260205260409081902080546001600160601b0393909316620100000262010000600160701b031990931692909217909155517f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9090612d5c90889088908690614b2c565b6001600160a01b0382166000908152600260205260408120546201000090046001600160601b03169061352c8383614862565b90507f000000000000000000000000000000000000000000000000000000000000000081101561359157604051631d820b1760e01b81527f000000000000000000000000000000000000000000000000000000000000000060048201526024016106c7565b600554600160601b90046001600160501b0316808211156135b6576132ad83826148b0565b60006135c26002613fa9565b9050808511156135e857604051631728673b60e31b8152600481018290526024016106c7565b6135f36116f8611522565b600061361f867f0000000000000000000000000000000000000000000000000000000000000000612d98565b905061362f611803600783612dae565b6001600160a01b038816600090815260076020526040812080549091906136609084906001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b031602179055506136bb816136b2887f0000000000000000000000000000000000000000000000000000000000000000613797565b60079190614030565b6136c486612357565b600480546002906136e59084906201000090046001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061371284612357565b6001600160a01b0388166000908152600260205260409081902080546001600160601b0393909316620100000262010000600160701b031990931692909217909155517f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee909061378690899089908890614b2c565b60405180910390a150505050505050565b6000610f1d8284614b85565b60005b600184015481101561380c578360000160008560010183815481106137cd576137cd614abd565b60009182526020808320909101546001600160a01b031683528201929092526040019020805461ff00191690558061380481614b13565b9150506137a6565b5061381b6001840160006143a4565b60005b818110156138f057600083838381811061383a5761383a614abd565b905060200201602081019061384f9190614512565b905061385b858261288a565b61387a578060405163eac13dcd60e01b81526004016106c79190614432565b6001600160a01b038116600090815260208690526040902054610100900460ff16156138ba5780604051625290b360e11b81526004016106c79190614432565b6001600160a01b03166000908152602085905260409020805461ff001916610100179055806138e881614b13565b91505061381e565b506138ff6001840183836143c2565b507f40aed8e423b39a56b445ae160f4c071fc2cfb48ee0b6dcd5ffeb6bc5b18d10d08282604051613931929190614bd2565b60405180910390a1505050565b600061394e826004015442101590565b6139675742826004015461396291906148b0565b610b4c565b600092915050565b600283015460009064e8d4a51000908390613993906001600160501b031686614b66565b612e519190614b66565b600060ff8211156123815760405163408ba96f60e11b815260040160405180910390fd5b600081156139f057507f0000000000000000000000000000000000000000000000000000000000000000610b4c565b610f1d6139fe600585614b85565b7f000000000000000000000000000000000000000000000000000000000000000061403d565b600186015460ff16156110a2576000613a3e878787614053565b90506000613a4d888785614060565b9050600080600087516001600160401b03811115613a6d57613a6d614605565b604051908082528060200260200182016040528015613a96578160200160208202803683370190505b509050600088516001600160401b03811115613ab457613ab4614605565b604051908082528060200260200182016040528015613add578160200160208202803683370190505b50905060005b8951811015613bfc5760008a8281518110613b0057613b00614abd565b6020908102919091018101516001600160a01b0381166000908152918c905260408220549092506201000090046001600160601b031690819003613b45575050613bea565b613b518f8a84846140bf565b858481518110613b6357613b63614abd565b602002602001018181525050613b7b8f89848d614148565b848481518110613b8d57613b8d614abd565b602002602001018181525050848381518110613bab57613bab614abd565b602002602001015187613bbe9190614862565b9650838381518110613bd257613bd2614abd565b602002602001015186613be59190614862565b955050505b80613bf481614b13565b915050613ae3565b50613c0684612357565b60038d018054600090613c239084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550613c5083612357565b60038d018054600c90613c74908490600160601b90046001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b031602179055507e635ea9da6e262e92bb713d71840af7c567807ff35bf73e927490c612832480898383604051613cca93929190614c4e565b60405180910390a1505050505050505050505050565b613cea8382612a6c565b613cf383612adf565b613d0783613d0183856148b0565b836141a7565b505042600490910155565b60028101805460ff191690556040517ff7d0e0f15586495da8c687328ead30fb829d9da55538cb0ef73dd229e517cdb890600090a150565b336001600160a01b03821603613d9c5760405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103a3930b739b332b9103a379039b2b63360491b60448201526064016106c7565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6001600160a01b03811660009081526020849052604081205460028501546001600160601b039182169164e8d4a5100091613e3191600160501b9091041686614b66565b612bd59190614b85565b613e43610978565b6107e85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106c7565b600080613e97846004015442101590565b613ebc576001840154613eb790600160681b900463ffffffff16426148b0565b613edd565b60018401546004850154613edd91600160681b900463ffffffff16906148b0565b600180860154919250613ef39160ff16906141b4565b613efe85858461396f565b613f089190614b85565b60018501546116d5919061010090046001600160601b0316614862565b6000610b4c82600401544261403d565b600063ffffffff8211156123815760405163408ba96f60e11b815260040160405180910390fd5b600081815b8451811015613fa157613f8d82868381518110613f8057613f80614abd565b60200260200101516141c3565b915080613f9981614b13565b915050613f61565b509392505050565b60408051608081018252600283015460ff80821615158352610100820416602083018190526001600160601b036201000083048116948401859052600160701b9092049091166060830152600384015460009391614018916001600160501b03600160b01b9091041690614b66565b60038501546112b191906001600160601b03166148b0565b6110d583838360016141f2565b600081831061404c5781610f1d565b5090919050565b60006116d584848461396f565b60408051606081018252600185015460ff811680835261010082046001600160601b03166020840152600160681b90910463ffffffff16928201929092526000916140ac86858761396f565b6140b69190614b85565b95945050505050565b6000806140cd868585612d6c565b905060006140db868361403d565b90506140e681612357565b6001600160a01b038616600090815260208990526040812080549091906141179084906001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b031602179055508092505050949350505050565b600080614156868585612ba2565b90506000614164868361403d565b905061416f81612357565b6001600160a01b03861660009081526020899052604090208054600c90614117908490600160601b90046001600160601b0316614b99565b6110d583838360006141f2565b600081831161404c5781610f1d565b60008183106141df576000828152602084905260409020610f1d565b6000838152602083905260409020610f1d565b60006141fd8561393e565b9050600061420f61180387878561396f565b9050600061422161180388878661396f565b9050831561430957600061423a64e8d4a51000886149b2565b111561424e578161424a81614c91565b9250505b600061425f64e8d4a51000876149b2565b1115614273578061426f81614c91565b9150505b6003870180548391906000906142939084906001600160601b0316614b99565b92506101000a8154816001600160601b0302191690836001600160601b031602179055508087600301600001600c8282829054906101000a90046001600160601b03166142e09190614b99565b92506101000a8154816001600160601b0302191690836001600160601b0316021790555061439b565b6003870180548391906000906143299084906001600160601b0316614ad3565b92506101000a8154816001600160601b0302191690836001600160601b031602179055508087600301600001600c8282829054906101000a90046001600160601b03166143769190614ad3565b92506101000a8154816001600160601b0302191690836001600160601b031602179055505b50505050505050565b508054600082559060005260206000209081019061208a919061441d565b828054828255906000526020600020908101928215614415579160200282015b828111156144155781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906143e2565b506123819291505b5b80821115612381576000815560010161441e565b6001600160a01b0391909116815260200190565b6000815180845260005b8181101561446c57602081850181015186830182015201614450565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610f1d6020830184614446565b600081518084526020808501945080840160005b838110156144d85781516001600160a01b0316875295820195908201906001016144b3565b509495945050505050565b602081526000610f1d602083018461449f565b80356001600160a01b038116811461450d57600080fd5b919050565b60006020828403121561452457600080fd5b610f1d826144f6565b60006020828403121561453f57600080fd5b5035919050565b6000806020838503121561455957600080fd5b82356001600160401b038082111561457057600080fd5b818501915085601f83011261458457600080fd5b81358181111561459357600080fd5b8660208285010111156145a557600080fd5b60209290920196919550909350505050565b6000806000606084860312156145cc57600080fd5b505081359360208301359350604090920135919050565b600080604083850312156145f657600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561464357614643614605565b604052919050565b60006001600160401b0382111561466457614664614605565b5060051b60200190565b6000806040838503121561468157600080fd5b61468a836144f6565b91506020808401356001600160401b038111156146a657600080fd5b8401601f810186136146b757600080fd5b80356146ca6146c58261464b565b61461b565b81815260059190911b820183019083810190888311156146e957600080fd5b928401925b82841015614707578335825292840192908401906146ee565b80955050505050509250929050565b6000806020838503121561472957600080fd5b82356001600160401b038082111561474057600080fd5b818501915085601f83011261475457600080fd5b81358181111561476357600080fd5b8660208260051b85010111156145a557600080fd5b60008060006060848603121561478d57600080fd5b614796846144f6565b9250602080850135925060408501356001600160401b03808211156147ba57600080fd5b818701915087601f8301126147ce57600080fd5b8135818111156147e0576147e0614605565b6147f2601f8201601f1916850161461b565b9150808252888482850101111561480857600080fd5b80848401858401376000848284010152508093505050509250925092565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b4c57610b4c61484c565b6001600160a01b03929092168252602082015260400190565b6000602082840312156148a057600080fd5b81518015158114610f1d57600080fd5b81810381811115610b4c57610b4c61484c565b6001600160a01b039384168152919092166020820152604081019190915260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038716815285602082015284604082015283606082015260a06080820152600061494460a0830184866148e7565b98975050505050505050565b6001600160a01b03841681526040602082018190526000906140b690830184866148e7565b60018060a01b03841681528260208201526060604082015260006140b66060830184614446565b634e487b7160e01b600052601260045260246000fd5b6000826149c1576149c161499c565b500690565b600060208083850312156149d957600080fd5b82516001600160401b038111156149ef57600080fd5b8301601f81018513614a0057600080fd5b8051614a0e6146c58261464b565b81815260059190911b82018301908381019087831115614a2d57600080fd5b928401925b82841015614a4b57835182529284019290840190614a32565b979650505050505050565b80516001600160501b038116811461450d57600080fd5b600080600080600060a08688031215614a8557600080fd5b614a8e86614a56565b9450602086015193506040860151925060608601519150614ab160808701614a56565b90509295509295909350565b634e487b7160e01b600052603260045260246000fd5b6001600160601b03828116828216039080821115614af357614af361484c565b5092915050565b60ff8281168282160390811115610b4c57610b4c61484c565b600060018201614b2557614b2561484c565b5060010190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060208284031215614b5f57600080fd5b5051919050565b6000816000190483118215151615614b8057614b8061484c565b500290565b600082614b9457614b9461499c565b500490565b6001600160601b03818116838216019080821115614af357614af361484c565b60ff8181168382160190811115610b4c57610b4c61484c565b60208082528181018390526000908460408401835b86811015614c13576001600160a01b03614c00846144f6565b1682529183019190830190600101614be7565b509695505050505050565b600081518084526020808501945080840160005b838110156144d857815187529582019590820190600101614c32565b606081526000614c61606083018661449f565b8281036020840152614c738186614c1e565b90508281036040840152614c878185614c1e565b9695505050505050565b60006001600160601b038281166002600160601b03198101614cb557614cb561484c565b600101939250505056fea2646970667358221220e6f8c7e5a925ed427780f5a651fa7904325bcaa2742e17b72555be4f810f5d6564736f6c63430008100033", -} - -// StakingABI is the input ABI used to generate the binding from. -// Deprecated: Use StakingMetaData.ABI instead. -var StakingABI = StakingMetaData.ABI - -// StakingBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use StakingMetaData.Bin instead. -var StakingBin = StakingMetaData.Bin - -// DeployStaking deploys a new Ethereum contract, binding an instance of Staking to it. -func DeployStaking(auth *bind.TransactOpts, backend bind.ContractBackend, params StakingPoolConstructorParams) (common.Address, *types.Transaction, *Staking, error) { - parsed, err := StakingMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(StakingBin), backend, params) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Staking{StakingCaller: StakingCaller{contract: contract}, StakingTransactor: StakingTransactor{contract: contract}, StakingFilterer: StakingFilterer{contract: contract}}, nil -} - -// Staking is an auto generated Go binding around an Ethereum contract. -type Staking struct { - StakingCaller // Read-only binding to the contract - StakingTransactor // Write-only binding to the contract - StakingFilterer // Log filterer for contract events -} - -// StakingCaller is an auto generated read-only Go binding around an Ethereum contract. -type StakingCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingTransactor is an auto generated write-only Go binding around an Ethereum contract. -type StakingTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type StakingFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// StakingSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type StakingSession struct { - Contract *Staking // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type StakingCallerSession struct { - Contract *StakingCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// StakingTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type StakingTransactorSession struct { - Contract *StakingTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// StakingRaw is an auto generated low-level Go binding around an Ethereum contract. -type StakingRaw struct { - Contract *Staking // Generic contract binding to access the raw methods on -} - -// StakingCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type StakingCallerRaw struct { - Contract *StakingCaller // Generic read-only contract binding to access the raw methods on -} - -// StakingTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type StakingTransactorRaw struct { - Contract *StakingTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewStaking creates a new instance of Staking, bound to a specific deployed contract. -func NewStaking(address common.Address, backend bind.ContractBackend) (*Staking, error) { - contract, err := bindStaking(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Staking{StakingCaller: StakingCaller{contract: contract}, StakingTransactor: StakingTransactor{contract: contract}, StakingFilterer: StakingFilterer{contract: contract}}, nil -} - -// NewStakingCaller creates a new read-only instance of Staking, bound to a specific deployed contract. -func NewStakingCaller(address common.Address, caller bind.ContractCaller) (*StakingCaller, error) { - contract, err := bindStaking(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StakingCaller{contract: contract}, nil -} - -// NewStakingTransactor creates a new write-only instance of Staking, bound to a specific deployed contract. -func NewStakingTransactor(address common.Address, transactor bind.ContractTransactor) (*StakingTransactor, error) { - contract, err := bindStaking(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StakingTransactor{contract: contract}, nil -} - -// NewStakingFilterer creates a new log filterer instance of Staking, bound to a specific deployed contract. -func NewStakingFilterer(address common.Address, filterer bind.ContractFilterer) (*StakingFilterer, error) { - contract, err := bindStaking(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StakingFilterer{contract: contract}, nil -} - -// bindStaking binds a generic wrapper to an already deployed contract. -func bindStaking(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(StakingABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Staking *StakingRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Staking.Contract.StakingCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Staking *StakingRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.Contract.StakingTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Staking *StakingRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Staking.Contract.StakingTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Staking *StakingCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Staking.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Staking *StakingTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Staking *StakingTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Staking.Contract.contract.Transact(opts, method, params...) -} - -// CanAlert is a free data retrieval call binding the contract method 0xc1852f58. -// -// Solidity: function canAlert(address alerter) view returns(bool) -func (_Staking *StakingCaller) CanAlert(opts *bind.CallOpts, alerter common.Address) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "canAlert", alerter) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// CanAlert is a free data retrieval call binding the contract method 0xc1852f58. -// -// Solidity: function canAlert(address alerter) view returns(bool) -func (_Staking *StakingSession) CanAlert(alerter common.Address) (bool, error) { - return _Staking.Contract.CanAlert(&_Staking.CallOpts, alerter) -} - -// CanAlert is a free data retrieval call binding the contract method 0xc1852f58. -// -// Solidity: function canAlert(address alerter) view returns(bool) -func (_Staking *StakingCallerSession) CanAlert(alerter common.Address) (bool, error) { - return _Staking.Contract.CanAlert(&_Staking.CallOpts, alerter) -} - -// GetAvailableReward is a free data retrieval call binding the contract method 0xe0974ea5. -// -// Solidity: function getAvailableReward() view returns(uint256) -func (_Staking *StakingCaller) GetAvailableReward(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getAvailableReward") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetAvailableReward is a free data retrieval call binding the contract method 0xe0974ea5. -// -// Solidity: function getAvailableReward() view returns(uint256) -func (_Staking *StakingSession) GetAvailableReward() (*big.Int, error) { - return _Staking.Contract.GetAvailableReward(&_Staking.CallOpts) -} - -// GetAvailableReward is a free data retrieval call binding the contract method 0xe0974ea5. -// -// Solidity: function getAvailableReward() view returns(uint256) -func (_Staking *StakingCallerSession) GetAvailableReward() (*big.Int, error) { - return _Staking.Contract.GetAvailableReward(&_Staking.CallOpts) -} - -// GetBaseReward is a free data retrieval call binding the contract method 0x9a109bc2. -// -// Solidity: function getBaseReward(address staker) view returns(uint256) -func (_Staking *StakingCaller) GetBaseReward(opts *bind.CallOpts, staker common.Address) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getBaseReward", staker) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetBaseReward is a free data retrieval call binding the contract method 0x9a109bc2. -// -// Solidity: function getBaseReward(address staker) view returns(uint256) -func (_Staking *StakingSession) GetBaseReward(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetBaseReward(&_Staking.CallOpts, staker) -} - -// GetBaseReward is a free data retrieval call binding the contract method 0x9a109bc2. -// -// Solidity: function getBaseReward(address staker) view returns(uint256) -func (_Staking *StakingCallerSession) GetBaseReward(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetBaseReward(&_Staking.CallOpts, staker) -} - -// GetChainlinkToken is a free data retrieval call binding the contract method 0x165d35e1. -// -// Solidity: function getChainlinkToken() view returns(address) -func (_Staking *StakingCaller) GetChainlinkToken(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getChainlinkToken") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// GetChainlinkToken is a free data retrieval call binding the contract method 0x165d35e1. -// -// Solidity: function getChainlinkToken() view returns(address) -func (_Staking *StakingSession) GetChainlinkToken() (common.Address, error) { - return _Staking.Contract.GetChainlinkToken(&_Staking.CallOpts) -} - -// GetChainlinkToken is a free data retrieval call binding the contract method 0x165d35e1. -// -// Solidity: function getChainlinkToken() view returns(address) -func (_Staking *StakingCallerSession) GetChainlinkToken() (common.Address, error) { - return _Staking.Contract.GetChainlinkToken(&_Staking.CallOpts) -} - -// GetCommunityStakerLimits is a free data retrieval call binding the contract method 0x0641bdd8. -// -// Solidity: function getCommunityStakerLimits() view returns(uint256, uint256) -func (_Staking *StakingCaller) GetCommunityStakerLimits(opts *bind.CallOpts) (*big.Int, *big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getCommunityStakerLimits") - - if err != nil { - return *new(*big.Int), *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return out0, out1, err - -} - -// GetCommunityStakerLimits is a free data retrieval call binding the contract method 0x0641bdd8. -// -// Solidity: function getCommunityStakerLimits() view returns(uint256, uint256) -func (_Staking *StakingSession) GetCommunityStakerLimits() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetCommunityStakerLimits(&_Staking.CallOpts) -} - -// GetCommunityStakerLimits is a free data retrieval call binding the contract method 0x0641bdd8. -// -// Solidity: function getCommunityStakerLimits() view returns(uint256, uint256) -func (_Staking *StakingCallerSession) GetCommunityStakerLimits() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetCommunityStakerLimits(&_Staking.CallOpts) -} - -// GetDelegatesCount is a free data retrieval call binding the contract method 0x32e28850. -// -// Solidity: function getDelegatesCount() view returns(uint256) -func (_Staking *StakingCaller) GetDelegatesCount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getDelegatesCount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetDelegatesCount is a free data retrieval call binding the contract method 0x32e28850. -// -// Solidity: function getDelegatesCount() view returns(uint256) -func (_Staking *StakingSession) GetDelegatesCount() (*big.Int, error) { - return _Staking.Contract.GetDelegatesCount(&_Staking.CallOpts) -} - -// GetDelegatesCount is a free data retrieval call binding the contract method 0x32e28850. -// -// Solidity: function getDelegatesCount() view returns(uint256) -func (_Staking *StakingCallerSession) GetDelegatesCount() (*big.Int, error) { - return _Staking.Contract.GetDelegatesCount(&_Staking.CallOpts) -} - -// GetDelegationRateDenominator is a free data retrieval call binding the contract method 0x5e8b40d7. -// -// Solidity: function getDelegationRateDenominator() view returns(uint256) -func (_Staking *StakingCaller) GetDelegationRateDenominator(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getDelegationRateDenominator") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetDelegationRateDenominator is a free data retrieval call binding the contract method 0x5e8b40d7. -// -// Solidity: function getDelegationRateDenominator() view returns(uint256) -func (_Staking *StakingSession) GetDelegationRateDenominator() (*big.Int, error) { - return _Staking.Contract.GetDelegationRateDenominator(&_Staking.CallOpts) -} - -// GetDelegationRateDenominator is a free data retrieval call binding the contract method 0x5e8b40d7. -// -// Solidity: function getDelegationRateDenominator() view returns(uint256) -func (_Staking *StakingCallerSession) GetDelegationRateDenominator() (*big.Int, error) { - return _Staking.Contract.GetDelegationRateDenominator(&_Staking.CallOpts) -} - -// GetDelegationReward is a free data retrieval call binding the contract method 0x87e900b1. -// -// Solidity: function getDelegationReward(address staker) view returns(uint256) -func (_Staking *StakingCaller) GetDelegationReward(opts *bind.CallOpts, staker common.Address) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getDelegationReward", staker) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetDelegationReward is a free data retrieval call binding the contract method 0x87e900b1. -// -// Solidity: function getDelegationReward(address staker) view returns(uint256) -func (_Staking *StakingSession) GetDelegationReward(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetDelegationReward(&_Staking.CallOpts, staker) -} - -// GetDelegationReward is a free data retrieval call binding the contract method 0x87e900b1. -// -// Solidity: function getDelegationReward(address staker) view returns(uint256) -func (_Staking *StakingCallerSession) GetDelegationReward(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetDelegationReward(&_Staking.CallOpts, staker) -} - -// GetEarnedBaseRewards is a free data retrieval call binding the contract method 0x1a9d4c7c. -// -// Solidity: function getEarnedBaseRewards() view returns(uint256) -func (_Staking *StakingCaller) GetEarnedBaseRewards(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getEarnedBaseRewards") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetEarnedBaseRewards is a free data retrieval call binding the contract method 0x1a9d4c7c. -// -// Solidity: function getEarnedBaseRewards() view returns(uint256) -func (_Staking *StakingSession) GetEarnedBaseRewards() (*big.Int, error) { - return _Staking.Contract.GetEarnedBaseRewards(&_Staking.CallOpts) -} - -// GetEarnedBaseRewards is a free data retrieval call binding the contract method 0x1a9d4c7c. -// -// Solidity: function getEarnedBaseRewards() view returns(uint256) -func (_Staking *StakingCallerSession) GetEarnedBaseRewards() (*big.Int, error) { - return _Staking.Contract.GetEarnedBaseRewards(&_Staking.CallOpts) -} - -// GetEarnedDelegationRewards is a free data retrieval call binding the contract method 0x74104002. -// -// Solidity: function getEarnedDelegationRewards() view returns(uint256) -func (_Staking *StakingCaller) GetEarnedDelegationRewards(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getEarnedDelegationRewards") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetEarnedDelegationRewards is a free data retrieval call binding the contract method 0x74104002. -// -// Solidity: function getEarnedDelegationRewards() view returns(uint256) -func (_Staking *StakingSession) GetEarnedDelegationRewards() (*big.Int, error) { - return _Staking.Contract.GetEarnedDelegationRewards(&_Staking.CallOpts) -} - -// GetEarnedDelegationRewards is a free data retrieval call binding the contract method 0x74104002. -// -// Solidity: function getEarnedDelegationRewards() view returns(uint256) -func (_Staking *StakingCallerSession) GetEarnedDelegationRewards() (*big.Int, error) { - return _Staking.Contract.GetEarnedDelegationRewards(&_Staking.CallOpts) -} - -// GetFeedOperators is a free data retrieval call binding the contract method 0x5fec60f8. -// -// Solidity: function getFeedOperators() view returns(address[]) -func (_Staking *StakingCaller) GetFeedOperators(opts *bind.CallOpts) ([]common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getFeedOperators") - - if err != nil { - return *new([]common.Address), err - } - - out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) - - return out0, err - -} - -// GetFeedOperators is a free data retrieval call binding the contract method 0x5fec60f8. -// -// Solidity: function getFeedOperators() view returns(address[]) -func (_Staking *StakingSession) GetFeedOperators() ([]common.Address, error) { - return _Staking.Contract.GetFeedOperators(&_Staking.CallOpts) -} - -// GetFeedOperators is a free data retrieval call binding the contract method 0x5fec60f8. -// -// Solidity: function getFeedOperators() view returns(address[]) -func (_Staking *StakingCallerSession) GetFeedOperators() ([]common.Address, error) { - return _Staking.Contract.GetFeedOperators(&_Staking.CallOpts) -} - -// GetMaxPoolSize is a free data retrieval call binding the contract method 0x0fbc8f5b. -// -// Solidity: function getMaxPoolSize() view returns(uint256) -func (_Staking *StakingCaller) GetMaxPoolSize(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getMaxPoolSize") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetMaxPoolSize is a free data retrieval call binding the contract method 0x0fbc8f5b. -// -// Solidity: function getMaxPoolSize() view returns(uint256) -func (_Staking *StakingSession) GetMaxPoolSize() (*big.Int, error) { - return _Staking.Contract.GetMaxPoolSize(&_Staking.CallOpts) -} - -// GetMaxPoolSize is a free data retrieval call binding the contract method 0x0fbc8f5b. -// -// Solidity: function getMaxPoolSize() view returns(uint256) -func (_Staking *StakingCallerSession) GetMaxPoolSize() (*big.Int, error) { - return _Staking.Contract.GetMaxPoolSize(&_Staking.CallOpts) -} - -// GetMerkleRoot is a free data retrieval call binding the contract method 0x49590657. -// -// Solidity: function getMerkleRoot() view returns(bytes32) -func (_Staking *StakingCaller) GetMerkleRoot(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getMerkleRoot") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetMerkleRoot is a free data retrieval call binding the contract method 0x49590657. -// -// Solidity: function getMerkleRoot() view returns(bytes32) -func (_Staking *StakingSession) GetMerkleRoot() ([32]byte, error) { - return _Staking.Contract.GetMerkleRoot(&_Staking.CallOpts) -} - -// GetMerkleRoot is a free data retrieval call binding the contract method 0x49590657. -// -// Solidity: function getMerkleRoot() view returns(bytes32) -func (_Staking *StakingCallerSession) GetMerkleRoot() ([32]byte, error) { - return _Staking.Contract.GetMerkleRoot(&_Staking.CallOpts) -} - -// GetMigrationTarget is a free data retrieval call binding the contract method 0x1ddb5552. -// -// Solidity: function getMigrationTarget() view returns(address) -func (_Staking *StakingCaller) GetMigrationTarget(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getMigrationTarget") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// GetMigrationTarget is a free data retrieval call binding the contract method 0x1ddb5552. -// -// Solidity: function getMigrationTarget() view returns(address) -func (_Staking *StakingSession) GetMigrationTarget() (common.Address, error) { - return _Staking.Contract.GetMigrationTarget(&_Staking.CallOpts) -} - -// GetMigrationTarget is a free data retrieval call binding the contract method 0x1ddb5552. -// -// Solidity: function getMigrationTarget() view returns(address) -func (_Staking *StakingCallerSession) GetMigrationTarget() (common.Address, error) { - return _Staking.Contract.GetMigrationTarget(&_Staking.CallOpts) -} - -// GetMonitoredFeed is a free data retrieval call binding the contract method 0x83db28a0. -// -// Solidity: function getMonitoredFeed() view returns(address) -func (_Staking *StakingCaller) GetMonitoredFeed(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getMonitoredFeed") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// GetMonitoredFeed is a free data retrieval call binding the contract method 0x83db28a0. -// -// Solidity: function getMonitoredFeed() view returns(address) -func (_Staking *StakingSession) GetMonitoredFeed() (common.Address, error) { - return _Staking.Contract.GetMonitoredFeed(&_Staking.CallOpts) -} - -// GetMonitoredFeed is a free data retrieval call binding the contract method 0x83db28a0. -// -// Solidity: function getMonitoredFeed() view returns(address) -func (_Staking *StakingCallerSession) GetMonitoredFeed() (common.Address, error) { - return _Staking.Contract.GetMonitoredFeed(&_Staking.CallOpts) -} - -// GetOperatorLimits is a free data retrieval call binding the contract method 0x8856398f. -// -// Solidity: function getOperatorLimits() view returns(uint256, uint256) -func (_Staking *StakingCaller) GetOperatorLimits(opts *bind.CallOpts) (*big.Int, *big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getOperatorLimits") - - if err != nil { - return *new(*big.Int), *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return out0, out1, err - -} - -// GetOperatorLimits is a free data retrieval call binding the contract method 0x8856398f. -// -// Solidity: function getOperatorLimits() view returns(uint256, uint256) -func (_Staking *StakingSession) GetOperatorLimits() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetOperatorLimits(&_Staking.CallOpts) -} - -// GetOperatorLimits is a free data retrieval call binding the contract method 0x8856398f. -// -// Solidity: function getOperatorLimits() view returns(uint256, uint256) -func (_Staking *StakingCallerSession) GetOperatorLimits() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetOperatorLimits(&_Staking.CallOpts) -} - -// GetRewardRate is a free data retrieval call binding the contract method 0x7e1a3786. -// -// Solidity: function getRewardRate() view returns(uint256) -func (_Staking *StakingCaller) GetRewardRate(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getRewardRate") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetRewardRate is a free data retrieval call binding the contract method 0x7e1a3786. -// -// Solidity: function getRewardRate() view returns(uint256) -func (_Staking *StakingSession) GetRewardRate() (*big.Int, error) { - return _Staking.Contract.GetRewardRate(&_Staking.CallOpts) -} - -// GetRewardRate is a free data retrieval call binding the contract method 0x7e1a3786. -// -// Solidity: function getRewardRate() view returns(uint256) -func (_Staking *StakingCallerSession) GetRewardRate() (*big.Int, error) { - return _Staking.Contract.GetRewardRate(&_Staking.CallOpts) -} - -// GetRewardTimestamps is a free data retrieval call binding the contract method 0x59f01879. -// -// Solidity: function getRewardTimestamps() view returns(uint256, uint256) -func (_Staking *StakingCaller) GetRewardTimestamps(opts *bind.CallOpts) (*big.Int, *big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getRewardTimestamps") - - if err != nil { - return *new(*big.Int), *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return out0, out1, err - -} - -// GetRewardTimestamps is a free data retrieval call binding the contract method 0x59f01879. -// -// Solidity: function getRewardTimestamps() view returns(uint256, uint256) -func (_Staking *StakingSession) GetRewardTimestamps() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetRewardTimestamps(&_Staking.CallOpts) -} - -// GetRewardTimestamps is a free data retrieval call binding the contract method 0x59f01879. -// -// Solidity: function getRewardTimestamps() view returns(uint256, uint256) -func (_Staking *StakingCallerSession) GetRewardTimestamps() (*big.Int, *big.Int, error) { - return _Staking.Contract.GetRewardTimestamps(&_Staking.CallOpts) -} - -// GetStake is a free data retrieval call binding the contract method 0x7a766460. -// -// Solidity: function getStake(address staker) view returns(uint256) -func (_Staking *StakingCaller) GetStake(opts *bind.CallOpts, staker common.Address) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getStake", staker) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetStake is a free data retrieval call binding the contract method 0x7a766460. -// -// Solidity: function getStake(address staker) view returns(uint256) -func (_Staking *StakingSession) GetStake(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetStake(&_Staking.CallOpts, staker) -} - -// GetStake is a free data retrieval call binding the contract method 0x7a766460. -// -// Solidity: function getStake(address staker) view returns(uint256) -func (_Staking *StakingCallerSession) GetStake(staker common.Address) (*big.Int, error) { - return _Staking.Contract.GetStake(&_Staking.CallOpts, staker) -} - -// GetTotalCommunityStakedAmount is a free data retrieval call binding the contract method 0x049b2ca0. -// -// Solidity: function getTotalCommunityStakedAmount() view returns(uint256) -func (_Staking *StakingCaller) GetTotalCommunityStakedAmount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getTotalCommunityStakedAmount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTotalCommunityStakedAmount is a free data retrieval call binding the contract method 0x049b2ca0. -// -// Solidity: function getTotalCommunityStakedAmount() view returns(uint256) -func (_Staking *StakingSession) GetTotalCommunityStakedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalCommunityStakedAmount(&_Staking.CallOpts) -} - -// GetTotalCommunityStakedAmount is a free data retrieval call binding the contract method 0x049b2ca0. -// -// Solidity: function getTotalCommunityStakedAmount() view returns(uint256) -func (_Staking *StakingCallerSession) GetTotalCommunityStakedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalCommunityStakedAmount(&_Staking.CallOpts) -} - -// GetTotalDelegatedAmount is a free data retrieval call binding the contract method 0xa7a2f5aa. -// -// Solidity: function getTotalDelegatedAmount() view returns(uint256) -func (_Staking *StakingCaller) GetTotalDelegatedAmount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getTotalDelegatedAmount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTotalDelegatedAmount is a free data retrieval call binding the contract method 0xa7a2f5aa. -// -// Solidity: function getTotalDelegatedAmount() view returns(uint256) -func (_Staking *StakingSession) GetTotalDelegatedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalDelegatedAmount(&_Staking.CallOpts) -} - -// GetTotalDelegatedAmount is a free data retrieval call binding the contract method 0xa7a2f5aa. -// -// Solidity: function getTotalDelegatedAmount() view returns(uint256) -func (_Staking *StakingCallerSession) GetTotalDelegatedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalDelegatedAmount(&_Staking.CallOpts) -} - -// GetTotalRemovedAmount is a free data retrieval call binding the contract method 0x8019e7d0. -// -// Solidity: function getTotalRemovedAmount() view returns(uint256) -func (_Staking *StakingCaller) GetTotalRemovedAmount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getTotalRemovedAmount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTotalRemovedAmount is a free data retrieval call binding the contract method 0x8019e7d0. -// -// Solidity: function getTotalRemovedAmount() view returns(uint256) -func (_Staking *StakingSession) GetTotalRemovedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalRemovedAmount(&_Staking.CallOpts) -} - -// GetTotalRemovedAmount is a free data retrieval call binding the contract method 0x8019e7d0. -// -// Solidity: function getTotalRemovedAmount() view returns(uint256) -func (_Staking *StakingCallerSession) GetTotalRemovedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalRemovedAmount(&_Staking.CallOpts) -} - -// GetTotalStakedAmount is a free data retrieval call binding the contract method 0x38adb6f0. -// -// Solidity: function getTotalStakedAmount() view returns(uint256) -func (_Staking *StakingCaller) GetTotalStakedAmount(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "getTotalStakedAmount") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetTotalStakedAmount is a free data retrieval call binding the contract method 0x38adb6f0. -// -// Solidity: function getTotalStakedAmount() view returns(uint256) -func (_Staking *StakingSession) GetTotalStakedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalStakedAmount(&_Staking.CallOpts) -} - -// GetTotalStakedAmount is a free data retrieval call binding the contract method 0x38adb6f0. -// -// Solidity: function getTotalStakedAmount() view returns(uint256) -func (_Staking *StakingCallerSession) GetTotalStakedAmount() (*big.Int, error) { - return _Staking.Contract.GetTotalStakedAmount(&_Staking.CallOpts) -} - -// HasAccess is a free data retrieval call binding the contract method 0x9d0a3864. -// -// Solidity: function hasAccess(address staker, bytes32[] proof) view returns(bool) -func (_Staking *StakingCaller) HasAccess(opts *bind.CallOpts, staker common.Address, proof [][32]byte) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "hasAccess", staker, proof) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// HasAccess is a free data retrieval call binding the contract method 0x9d0a3864. -// -// Solidity: function hasAccess(address staker, bytes32[] proof) view returns(bool) -func (_Staking *StakingSession) HasAccess(staker common.Address, proof [][32]byte) (bool, error) { - return _Staking.Contract.HasAccess(&_Staking.CallOpts, staker, proof) -} - -// HasAccess is a free data retrieval call binding the contract method 0x9d0a3864. -// -// Solidity: function hasAccess(address staker, bytes32[] proof) view returns(bool) -func (_Staking *StakingCallerSession) HasAccess(staker common.Address, proof [][32]byte) (bool, error) { - return _Staking.Contract.HasAccess(&_Staking.CallOpts, staker, proof) -} - -// IsActive is a free data retrieval call binding the contract method 0x22f3e2d4. -// -// Solidity: function isActive() view returns(bool) -func (_Staking *StakingCaller) IsActive(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "isActive") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsActive is a free data retrieval call binding the contract method 0x22f3e2d4. -// -// Solidity: function isActive() view returns(bool) -func (_Staking *StakingSession) IsActive() (bool, error) { - return _Staking.Contract.IsActive(&_Staking.CallOpts) -} - -// IsActive is a free data retrieval call binding the contract method 0x22f3e2d4. -// -// Solidity: function isActive() view returns(bool) -func (_Staking *StakingCallerSession) IsActive() (bool, error) { - return _Staking.Contract.IsActive(&_Staking.CallOpts) -} - -// IsOperator is a free data retrieval call binding the contract method 0x6d70f7ae. -// -// Solidity: function isOperator(address staker) view returns(bool) -func (_Staking *StakingCaller) IsOperator(opts *bind.CallOpts, staker common.Address) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "isOperator", staker) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsOperator is a free data retrieval call binding the contract method 0x6d70f7ae. -// -// Solidity: function isOperator(address staker) view returns(bool) -func (_Staking *StakingSession) IsOperator(staker common.Address) (bool, error) { - return _Staking.Contract.IsOperator(&_Staking.CallOpts, staker) -} - -// IsOperator is a free data retrieval call binding the contract method 0x6d70f7ae. -// -// Solidity: function isOperator(address staker) view returns(bool) -func (_Staking *StakingCallerSession) IsOperator(staker common.Address) (bool, error) { - return _Staking.Contract.IsOperator(&_Staking.CallOpts, staker) -} - -// IsPaused is a free data retrieval call binding the contract method 0xb187bd26. -// -// Solidity: function isPaused() view returns(bool) -func (_Staking *StakingCaller) IsPaused(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "isPaused") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsPaused is a free data retrieval call binding the contract method 0xb187bd26. -// -// Solidity: function isPaused() view returns(bool) -func (_Staking *StakingSession) IsPaused() (bool, error) { - return _Staking.Contract.IsPaused(&_Staking.CallOpts) -} - -// IsPaused is a free data retrieval call binding the contract method 0xb187bd26. -// -// Solidity: function isPaused() view returns(bool) -func (_Staking *StakingCallerSession) IsPaused() (bool, error) { - return _Staking.Contract.IsPaused(&_Staking.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Staking *StakingCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Staking *StakingSession) Owner() (common.Address, error) { - return _Staking.Contract.Owner(&_Staking.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_Staking *StakingCallerSession) Owner() (common.Address, error) { - return _Staking.Contract.Owner(&_Staking.CallOpts) -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_Staking *StakingCaller) Paused(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "paused") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_Staking *StakingSession) Paused() (bool, error) { - return _Staking.Contract.Paused(&_Staking.CallOpts) -} - -// Paused is a free data retrieval call binding the contract method 0x5c975abb. -// -// Solidity: function paused() view returns(bool) -func (_Staking *StakingCallerSession) Paused() (bool, error) { - return _Staking.Contract.Paused(&_Staking.CallOpts) -} - -// TypeAndVersion is a free data retrieval call binding the contract method 0x181f5a77. -// -// Solidity: function typeAndVersion() pure returns(string) -func (_Staking *StakingCaller) TypeAndVersion(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _Staking.contract.Call(opts, &out, "typeAndVersion") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -// TypeAndVersion is a free data retrieval call binding the contract method 0x181f5a77. -// -// Solidity: function typeAndVersion() pure returns(string) -func (_Staking *StakingSession) TypeAndVersion() (string, error) { - return _Staking.Contract.TypeAndVersion(&_Staking.CallOpts) -} - -// TypeAndVersion is a free data retrieval call binding the contract method 0x181f5a77. -// -// Solidity: function typeAndVersion() pure returns(string) -func (_Staking *StakingCallerSession) TypeAndVersion() (string, error) { - return _Staking.Contract.TypeAndVersion(&_Staking.CallOpts) -} - -// AcceptMigrationTarget is a paid mutator transaction binding the contract method 0xe937fdaa. -// -// Solidity: function acceptMigrationTarget() returns() -func (_Staking *StakingTransactor) AcceptMigrationTarget(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "acceptMigrationTarget") -} - -// AcceptMigrationTarget is a paid mutator transaction binding the contract method 0xe937fdaa. -// -// Solidity: function acceptMigrationTarget() returns() -func (_Staking *StakingSession) AcceptMigrationTarget() (*types.Transaction, error) { - return _Staking.Contract.AcceptMigrationTarget(&_Staking.TransactOpts) -} - -// AcceptMigrationTarget is a paid mutator transaction binding the contract method 0xe937fdaa. -// -// Solidity: function acceptMigrationTarget() returns() -func (_Staking *StakingTransactorSession) AcceptMigrationTarget() (*types.Transaction, error) { - return _Staking.Contract.AcceptMigrationTarget(&_Staking.TransactOpts) -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_Staking *StakingTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "acceptOwnership") -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_Staking *StakingSession) AcceptOwnership() (*types.Transaction, error) { - return _Staking.Contract.AcceptOwnership(&_Staking.TransactOpts) -} - -// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. -// -// Solidity: function acceptOwnership() returns() -func (_Staking *StakingTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _Staking.Contract.AcceptOwnership(&_Staking.TransactOpts) -} - -// AddOperators is a paid mutator transaction binding the contract method 0xa07aea1c. -// -// Solidity: function addOperators(address[] operators) returns() -func (_Staking *StakingTransactor) AddOperators(opts *bind.TransactOpts, operators []common.Address) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "addOperators", operators) -} - -// AddOperators is a paid mutator transaction binding the contract method 0xa07aea1c. -// -// Solidity: function addOperators(address[] operators) returns() -func (_Staking *StakingSession) AddOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.AddOperators(&_Staking.TransactOpts, operators) -} - -// AddOperators is a paid mutator transaction binding the contract method 0xa07aea1c. -// -// Solidity: function addOperators(address[] operators) returns() -func (_Staking *StakingTransactorSession) AddOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.AddOperators(&_Staking.TransactOpts, operators) -} - -// AddReward is a paid mutator transaction binding the contract method 0x74de4ec4. -// -// Solidity: function addReward(uint256 amount) returns() -func (_Staking *StakingTransactor) AddReward(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "addReward", amount) -} - -// AddReward is a paid mutator transaction binding the contract method 0x74de4ec4. -// -// Solidity: function addReward(uint256 amount) returns() -func (_Staking *StakingSession) AddReward(amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.AddReward(&_Staking.TransactOpts, amount) -} - -// AddReward is a paid mutator transaction binding the contract method 0x74de4ec4. -// -// Solidity: function addReward(uint256 amount) returns() -func (_Staking *StakingTransactorSession) AddReward(amount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.AddReward(&_Staking.TransactOpts, amount) -} - -// ChangeRewardRate is a paid mutator transaction binding the contract method 0x74f237c4. -// -// Solidity: function changeRewardRate(uint256 newRate) returns() -func (_Staking *StakingTransactor) ChangeRewardRate(opts *bind.TransactOpts, newRate *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "changeRewardRate", newRate) -} - -// ChangeRewardRate is a paid mutator transaction binding the contract method 0x74f237c4. -// -// Solidity: function changeRewardRate(uint256 newRate) returns() -func (_Staking *StakingSession) ChangeRewardRate(newRate *big.Int) (*types.Transaction, error) { - return _Staking.Contract.ChangeRewardRate(&_Staking.TransactOpts, newRate) -} - -// ChangeRewardRate is a paid mutator transaction binding the contract method 0x74f237c4. -// -// Solidity: function changeRewardRate(uint256 newRate) returns() -func (_Staking *StakingTransactorSession) ChangeRewardRate(newRate *big.Int) (*types.Transaction, error) { - return _Staking.Contract.ChangeRewardRate(&_Staking.TransactOpts, newRate) -} - -// Conclude is a paid mutator transaction binding the contract method 0xe5f92973. -// -// Solidity: function conclude() returns() -func (_Staking *StakingTransactor) Conclude(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "conclude") -} - -// Conclude is a paid mutator transaction binding the contract method 0xe5f92973. -// -// Solidity: function conclude() returns() -func (_Staking *StakingSession) Conclude() (*types.Transaction, error) { - return _Staking.Contract.Conclude(&_Staking.TransactOpts) -} - -// Conclude is a paid mutator transaction binding the contract method 0xe5f92973. -// -// Solidity: function conclude() returns() -func (_Staking *StakingTransactorSession) Conclude() (*types.Transaction, error) { - return _Staking.Contract.Conclude(&_Staking.TransactOpts) -} - -// EmergencyPause is a paid mutator transaction binding the contract method 0x51858e27. -// -// Solidity: function emergencyPause() returns() -func (_Staking *StakingTransactor) EmergencyPause(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "emergencyPause") -} - -// EmergencyPause is a paid mutator transaction binding the contract method 0x51858e27. -// -// Solidity: function emergencyPause() returns() -func (_Staking *StakingSession) EmergencyPause() (*types.Transaction, error) { - return _Staking.Contract.EmergencyPause(&_Staking.TransactOpts) -} - -// EmergencyPause is a paid mutator transaction binding the contract method 0x51858e27. -// -// Solidity: function emergencyPause() returns() -func (_Staking *StakingTransactorSession) EmergencyPause() (*types.Transaction, error) { - return _Staking.Contract.EmergencyPause(&_Staking.TransactOpts) -} - -// EmergencyUnpause is a paid mutator transaction binding the contract method 0x4a4e3bd5. -// -// Solidity: function emergencyUnpause() returns() -func (_Staking *StakingTransactor) EmergencyUnpause(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "emergencyUnpause") -} - -// EmergencyUnpause is a paid mutator transaction binding the contract method 0x4a4e3bd5. -// -// Solidity: function emergencyUnpause() returns() -func (_Staking *StakingSession) EmergencyUnpause() (*types.Transaction, error) { - return _Staking.Contract.EmergencyUnpause(&_Staking.TransactOpts) -} - -// EmergencyUnpause is a paid mutator transaction binding the contract method 0x4a4e3bd5. -// -// Solidity: function emergencyUnpause() returns() -func (_Staking *StakingTransactorSession) EmergencyUnpause() (*types.Transaction, error) { - return _Staking.Contract.EmergencyUnpause(&_Staking.TransactOpts) -} - -// Migrate is a paid mutator transaction binding the contract method 0x8932a90d. -// -// Solidity: function migrate(bytes data) returns() -func (_Staking *StakingTransactor) Migrate(opts *bind.TransactOpts, data []byte) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "migrate", data) -} - -// Migrate is a paid mutator transaction binding the contract method 0x8932a90d. -// -// Solidity: function migrate(bytes data) returns() -func (_Staking *StakingSession) Migrate(data []byte) (*types.Transaction, error) { - return _Staking.Contract.Migrate(&_Staking.TransactOpts, data) -} - -// Migrate is a paid mutator transaction binding the contract method 0x8932a90d. -// -// Solidity: function migrate(bytes data) returns() -func (_Staking *StakingTransactorSession) Migrate(data []byte) (*types.Transaction, error) { - return _Staking.Contract.Migrate(&_Staking.TransactOpts, data) -} - -// OnTokenTransfer is a paid mutator transaction binding the contract method 0xa4c0ed36. -// -// Solidity: function onTokenTransfer(address sender, uint256 amount, bytes data) returns() -func (_Staking *StakingTransactor) OnTokenTransfer(opts *bind.TransactOpts, sender common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "onTokenTransfer", sender, amount, data) -} - -// OnTokenTransfer is a paid mutator transaction binding the contract method 0xa4c0ed36. -// -// Solidity: function onTokenTransfer(address sender, uint256 amount, bytes data) returns() -func (_Staking *StakingSession) OnTokenTransfer(sender common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Staking.Contract.OnTokenTransfer(&_Staking.TransactOpts, sender, amount, data) -} - -// OnTokenTransfer is a paid mutator transaction binding the contract method 0xa4c0ed36. -// -// Solidity: function onTokenTransfer(address sender, uint256 amount, bytes data) returns() -func (_Staking *StakingTransactorSession) OnTokenTransfer(sender common.Address, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Staking.Contract.OnTokenTransfer(&_Staking.TransactOpts, sender, amount, data) -} - -// ProposeMigrationTarget is a paid mutator transaction binding the contract method 0x63b2c85a. -// -// Solidity: function proposeMigrationTarget(address migrationTarget) returns() -func (_Staking *StakingTransactor) ProposeMigrationTarget(opts *bind.TransactOpts, migrationTarget common.Address) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "proposeMigrationTarget", migrationTarget) -} - -// ProposeMigrationTarget is a paid mutator transaction binding the contract method 0x63b2c85a. -// -// Solidity: function proposeMigrationTarget(address migrationTarget) returns() -func (_Staking *StakingSession) ProposeMigrationTarget(migrationTarget common.Address) (*types.Transaction, error) { - return _Staking.Contract.ProposeMigrationTarget(&_Staking.TransactOpts, migrationTarget) -} - -// ProposeMigrationTarget is a paid mutator transaction binding the contract method 0x63b2c85a. -// -// Solidity: function proposeMigrationTarget(address migrationTarget) returns() -func (_Staking *StakingTransactorSession) ProposeMigrationTarget(migrationTarget common.Address) (*types.Transaction, error) { - return _Staking.Contract.ProposeMigrationTarget(&_Staking.TransactOpts, migrationTarget) -} - -// RaiseAlert is a paid mutator transaction binding the contract method 0xda9c732f. -// -// Solidity: function raiseAlert() returns() -func (_Staking *StakingTransactor) RaiseAlert(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "raiseAlert") -} - -// RaiseAlert is a paid mutator transaction binding the contract method 0xda9c732f. -// -// Solidity: function raiseAlert() returns() -func (_Staking *StakingSession) RaiseAlert() (*types.Transaction, error) { - return _Staking.Contract.RaiseAlert(&_Staking.TransactOpts) -} - -// RaiseAlert is a paid mutator transaction binding the contract method 0xda9c732f. -// -// Solidity: function raiseAlert() returns() -func (_Staking *StakingTransactorSession) RaiseAlert() (*types.Transaction, error) { - return _Staking.Contract.RaiseAlert(&_Staking.TransactOpts) -} - -// RemoveOperators is a paid mutator transaction binding the contract method 0xd365a377. -// -// Solidity: function removeOperators(address[] operators) returns() -func (_Staking *StakingTransactor) RemoveOperators(opts *bind.TransactOpts, operators []common.Address) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "removeOperators", operators) -} - -// RemoveOperators is a paid mutator transaction binding the contract method 0xd365a377. -// -// Solidity: function removeOperators(address[] operators) returns() -func (_Staking *StakingSession) RemoveOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.RemoveOperators(&_Staking.TransactOpts, operators) -} - -// RemoveOperators is a paid mutator transaction binding the contract method 0xd365a377. -// -// Solidity: function removeOperators(address[] operators) returns() -func (_Staking *StakingTransactorSession) RemoveOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.RemoveOperators(&_Staking.TransactOpts, operators) -} - -// SetFeedOperators is a paid mutator transaction binding the contract method 0xbfbd9b1b. -// -// Solidity: function setFeedOperators(address[] operators) returns() -func (_Staking *StakingTransactor) SetFeedOperators(opts *bind.TransactOpts, operators []common.Address) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "setFeedOperators", operators) -} - -// SetFeedOperators is a paid mutator transaction binding the contract method 0xbfbd9b1b. -// -// Solidity: function setFeedOperators(address[] operators) returns() -func (_Staking *StakingSession) SetFeedOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.SetFeedOperators(&_Staking.TransactOpts, operators) -} - -// SetFeedOperators is a paid mutator transaction binding the contract method 0xbfbd9b1b. -// -// Solidity: function setFeedOperators(address[] operators) returns() -func (_Staking *StakingTransactorSession) SetFeedOperators(operators []common.Address) (*types.Transaction, error) { - return _Staking.Contract.SetFeedOperators(&_Staking.TransactOpts, operators) -} - -// SetMerkleRoot is a paid mutator transaction binding the contract method 0x7cb64759. -// -// Solidity: function setMerkleRoot(bytes32 newMerkleRoot) returns() -func (_Staking *StakingTransactor) SetMerkleRoot(opts *bind.TransactOpts, newMerkleRoot [32]byte) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "setMerkleRoot", newMerkleRoot) -} - -// SetMerkleRoot is a paid mutator transaction binding the contract method 0x7cb64759. -// -// Solidity: function setMerkleRoot(bytes32 newMerkleRoot) returns() -func (_Staking *StakingSession) SetMerkleRoot(newMerkleRoot [32]byte) (*types.Transaction, error) { - return _Staking.Contract.SetMerkleRoot(&_Staking.TransactOpts, newMerkleRoot) -} - -// SetMerkleRoot is a paid mutator transaction binding the contract method 0x7cb64759. -// -// Solidity: function setMerkleRoot(bytes32 newMerkleRoot) returns() -func (_Staking *StakingTransactorSession) SetMerkleRoot(newMerkleRoot [32]byte) (*types.Transaction, error) { - return _Staking.Contract.SetMerkleRoot(&_Staking.TransactOpts, newMerkleRoot) -} - -// SetPoolConfig is a paid mutator transaction binding the contract method 0x8a44f337. -// -// Solidity: function setPoolConfig(uint256 maxPoolSize, uint256 maxCommunityStakeAmount, uint256 maxOperatorStakeAmount) returns() -func (_Staking *StakingTransactor) SetPoolConfig(opts *bind.TransactOpts, maxPoolSize *big.Int, maxCommunityStakeAmount *big.Int, maxOperatorStakeAmount *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "setPoolConfig", maxPoolSize, maxCommunityStakeAmount, maxOperatorStakeAmount) -} - -// SetPoolConfig is a paid mutator transaction binding the contract method 0x8a44f337. -// -// Solidity: function setPoolConfig(uint256 maxPoolSize, uint256 maxCommunityStakeAmount, uint256 maxOperatorStakeAmount) returns() -func (_Staking *StakingSession) SetPoolConfig(maxPoolSize *big.Int, maxCommunityStakeAmount *big.Int, maxOperatorStakeAmount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.SetPoolConfig(&_Staking.TransactOpts, maxPoolSize, maxCommunityStakeAmount, maxOperatorStakeAmount) -} - -// SetPoolConfig is a paid mutator transaction binding the contract method 0x8a44f337. -// -// Solidity: function setPoolConfig(uint256 maxPoolSize, uint256 maxCommunityStakeAmount, uint256 maxOperatorStakeAmount) returns() -func (_Staking *StakingTransactorSession) SetPoolConfig(maxPoolSize *big.Int, maxCommunityStakeAmount *big.Int, maxOperatorStakeAmount *big.Int) (*types.Transaction, error) { - return _Staking.Contract.SetPoolConfig(&_Staking.TransactOpts, maxPoolSize, maxCommunityStakeAmount, maxOperatorStakeAmount) -} - -// Start is a paid mutator transaction binding the contract method 0x8fb4b573. -// -// Solidity: function start(uint256 amount, uint256 initialRewardRate) returns() -func (_Staking *StakingTransactor) Start(opts *bind.TransactOpts, amount *big.Int, initialRewardRate *big.Int) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "start", amount, initialRewardRate) -} - -// Start is a paid mutator transaction binding the contract method 0x8fb4b573. -// -// Solidity: function start(uint256 amount, uint256 initialRewardRate) returns() -func (_Staking *StakingSession) Start(amount *big.Int, initialRewardRate *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Start(&_Staking.TransactOpts, amount, initialRewardRate) -} - -// Start is a paid mutator transaction binding the contract method 0x8fb4b573. -// -// Solidity: function start(uint256 amount, uint256 initialRewardRate) returns() -func (_Staking *StakingTransactorSession) Start(amount *big.Int, initialRewardRate *big.Int) (*types.Transaction, error) { - return _Staking.Contract.Start(&_Staking.TransactOpts, amount, initialRewardRate) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address to) returns() -func (_Staking *StakingTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "transferOwnership", to) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address to) returns() -func (_Staking *StakingSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _Staking.Contract.TransferOwnership(&_Staking.TransactOpts, to) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address to) returns() -func (_Staking *StakingTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _Staking.Contract.TransferOwnership(&_Staking.TransactOpts, to) -} - -// Unstake is a paid mutator transaction binding the contract method 0x2def6620. -// -// Solidity: function unstake() returns() -func (_Staking *StakingTransactor) Unstake(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "unstake") -} - -// Unstake is a paid mutator transaction binding the contract method 0x2def6620. -// -// Solidity: function unstake() returns() -func (_Staking *StakingSession) Unstake() (*types.Transaction, error) { - return _Staking.Contract.Unstake(&_Staking.TransactOpts) -} - -// Unstake is a paid mutator transaction binding the contract method 0x2def6620. -// -// Solidity: function unstake() returns() -func (_Staking *StakingTransactorSession) Unstake() (*types.Transaction, error) { - return _Staking.Contract.Unstake(&_Staking.TransactOpts) -} - -// WithdrawRemovedStake is a paid mutator transaction binding the contract method 0x5aa6e013. -// -// Solidity: function withdrawRemovedStake() returns() -func (_Staking *StakingTransactor) WithdrawRemovedStake(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "withdrawRemovedStake") -} - -// WithdrawRemovedStake is a paid mutator transaction binding the contract method 0x5aa6e013. -// -// Solidity: function withdrawRemovedStake() returns() -func (_Staking *StakingSession) WithdrawRemovedStake() (*types.Transaction, error) { - return _Staking.Contract.WithdrawRemovedStake(&_Staking.TransactOpts) -} - -// WithdrawRemovedStake is a paid mutator transaction binding the contract method 0x5aa6e013. -// -// Solidity: function withdrawRemovedStake() returns() -func (_Staking *StakingTransactorSession) WithdrawRemovedStake() (*types.Transaction, error) { - return _Staking.Contract.WithdrawRemovedStake(&_Staking.TransactOpts) -} - -// WithdrawUnusedReward is a paid mutator transaction binding the contract method 0xebdb56f3. -// -// Solidity: function withdrawUnusedReward() returns() -func (_Staking *StakingTransactor) WithdrawUnusedReward(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Staking.contract.Transact(opts, "withdrawUnusedReward") -} - -// WithdrawUnusedReward is a paid mutator transaction binding the contract method 0xebdb56f3. -// -// Solidity: function withdrawUnusedReward() returns() -func (_Staking *StakingSession) WithdrawUnusedReward() (*types.Transaction, error) { - return _Staking.Contract.WithdrawUnusedReward(&_Staking.TransactOpts) -} - -// WithdrawUnusedReward is a paid mutator transaction binding the contract method 0xebdb56f3. -// -// Solidity: function withdrawUnusedReward() returns() -func (_Staking *StakingTransactorSession) WithdrawUnusedReward() (*types.Transaction, error) { - return _Staking.Contract.WithdrawUnusedReward(&_Staking.TransactOpts) -} - -// StakingAlertRaisedIterator is returned from FilterAlertRaised and is used to iterate over the raw logs and unpacked data for AlertRaised events raised by the Staking contract. -type StakingAlertRaisedIterator struct { - Event *StakingAlertRaised // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingAlertRaisedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingAlertRaised) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingAlertRaised) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingAlertRaisedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingAlertRaisedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingAlertRaised represents a AlertRaised event raised by the Staking contract. -type StakingAlertRaised struct { - Alerter common.Address - RoundId *big.Int - RewardAmount *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAlertRaised is a free log retrieval operation binding the contract event 0xd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd. -// -// Solidity: event AlertRaised(address alerter, uint256 roundId, uint256 rewardAmount) -func (_Staking *StakingFilterer) FilterAlertRaised(opts *bind.FilterOpts) (*StakingAlertRaisedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "AlertRaised") - if err != nil { - return nil, err - } - return &StakingAlertRaisedIterator{contract: _Staking.contract, event: "AlertRaised", logs: logs, sub: sub}, nil -} - -// WatchAlertRaised is a free log subscription operation binding the contract event 0xd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd. -// -// Solidity: event AlertRaised(address alerter, uint256 roundId, uint256 rewardAmount) -func (_Staking *StakingFilterer) WatchAlertRaised(opts *bind.WatchOpts, sink chan<- *StakingAlertRaised) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "AlertRaised") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingAlertRaised) - if err := _Staking.contract.UnpackLog(event, "AlertRaised", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAlertRaised is a log parse operation binding the contract event 0xd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd. -// -// Solidity: event AlertRaised(address alerter, uint256 roundId, uint256 rewardAmount) -func (_Staking *StakingFilterer) ParseAlertRaised(log types.Log) (*StakingAlertRaised, error) { - event := new(StakingAlertRaised) - if err := _Staking.contract.UnpackLog(event, "AlertRaised", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingMerkleRootChangedIterator is returned from FilterMerkleRootChanged and is used to iterate over the raw logs and unpacked data for MerkleRootChanged events raised by the Staking contract. -type StakingMerkleRootChangedIterator struct { - Event *StakingMerkleRootChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingMerkleRootChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingMerkleRootChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingMerkleRootChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingMerkleRootChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingMerkleRootChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingMerkleRootChanged represents a MerkleRootChanged event raised by the Staking contract. -type StakingMerkleRootChanged struct { - NewMerkleRoot [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMerkleRootChanged is a free log retrieval operation binding the contract event 0x1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c. -// -// Solidity: event MerkleRootChanged(bytes32 newMerkleRoot) -func (_Staking *StakingFilterer) FilterMerkleRootChanged(opts *bind.FilterOpts) (*StakingMerkleRootChangedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "MerkleRootChanged") - if err != nil { - return nil, err - } - return &StakingMerkleRootChangedIterator{contract: _Staking.contract, event: "MerkleRootChanged", logs: logs, sub: sub}, nil -} - -// WatchMerkleRootChanged is a free log subscription operation binding the contract event 0x1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c. -// -// Solidity: event MerkleRootChanged(bytes32 newMerkleRoot) -func (_Staking *StakingFilterer) WatchMerkleRootChanged(opts *bind.WatchOpts, sink chan<- *StakingMerkleRootChanged) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "MerkleRootChanged") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingMerkleRootChanged) - if err := _Staking.contract.UnpackLog(event, "MerkleRootChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMerkleRootChanged is a log parse operation binding the contract event 0x1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c. -// -// Solidity: event MerkleRootChanged(bytes32 newMerkleRoot) -func (_Staking *StakingFilterer) ParseMerkleRootChanged(log types.Log) (*StakingMerkleRootChanged, error) { - event := new(StakingMerkleRootChanged) - if err := _Staking.contract.UnpackLog(event, "MerkleRootChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingMigratedIterator is returned from FilterMigrated and is used to iterate over the raw logs and unpacked data for Migrated events raised by the Staking contract. -type StakingMigratedIterator struct { - Event *StakingMigrated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingMigratedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingMigrated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingMigrated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingMigratedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingMigratedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingMigrated represents a Migrated event raised by the Staking contract. -type StakingMigrated struct { - Staker common.Address - Principal *big.Int - BaseReward *big.Int - DelegationReward *big.Int - Data []byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMigrated is a free log retrieval operation binding the contract event 0x667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434. -// -// Solidity: event Migrated(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward, bytes data) -func (_Staking *StakingFilterer) FilterMigrated(opts *bind.FilterOpts) (*StakingMigratedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "Migrated") - if err != nil { - return nil, err - } - return &StakingMigratedIterator{contract: _Staking.contract, event: "Migrated", logs: logs, sub: sub}, nil -} - -// WatchMigrated is a free log subscription operation binding the contract event 0x667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434. -// -// Solidity: event Migrated(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward, bytes data) -func (_Staking *StakingFilterer) WatchMigrated(opts *bind.WatchOpts, sink chan<- *StakingMigrated) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "Migrated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingMigrated) - if err := _Staking.contract.UnpackLog(event, "Migrated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMigrated is a log parse operation binding the contract event 0x667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434. -// -// Solidity: event Migrated(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward, bytes data) -func (_Staking *StakingFilterer) ParseMigrated(log types.Log) (*StakingMigrated, error) { - event := new(StakingMigrated) - if err := _Staking.contract.UnpackLog(event, "Migrated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingMigrationTargetAcceptedIterator is returned from FilterMigrationTargetAccepted and is used to iterate over the raw logs and unpacked data for MigrationTargetAccepted events raised by the Staking contract. -type StakingMigrationTargetAcceptedIterator struct { - Event *StakingMigrationTargetAccepted // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingMigrationTargetAcceptedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingMigrationTargetAccepted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingMigrationTargetAccepted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingMigrationTargetAcceptedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingMigrationTargetAcceptedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingMigrationTargetAccepted represents a MigrationTargetAccepted event raised by the Staking contract. -type StakingMigrationTargetAccepted struct { - MigrationTarget common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMigrationTargetAccepted is a free log retrieval operation binding the contract event 0xfa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd84. -// -// Solidity: event MigrationTargetAccepted(address migrationTarget) -func (_Staking *StakingFilterer) FilterMigrationTargetAccepted(opts *bind.FilterOpts) (*StakingMigrationTargetAcceptedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "MigrationTargetAccepted") - if err != nil { - return nil, err - } - return &StakingMigrationTargetAcceptedIterator{contract: _Staking.contract, event: "MigrationTargetAccepted", logs: logs, sub: sub}, nil -} - -// WatchMigrationTargetAccepted is a free log subscription operation binding the contract event 0xfa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd84. -// -// Solidity: event MigrationTargetAccepted(address migrationTarget) -func (_Staking *StakingFilterer) WatchMigrationTargetAccepted(opts *bind.WatchOpts, sink chan<- *StakingMigrationTargetAccepted) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "MigrationTargetAccepted") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingMigrationTargetAccepted) - if err := _Staking.contract.UnpackLog(event, "MigrationTargetAccepted", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMigrationTargetAccepted is a log parse operation binding the contract event 0xfa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd84. -// -// Solidity: event MigrationTargetAccepted(address migrationTarget) -func (_Staking *StakingFilterer) ParseMigrationTargetAccepted(log types.Log) (*StakingMigrationTargetAccepted, error) { - event := new(StakingMigrationTargetAccepted) - if err := _Staking.contract.UnpackLog(event, "MigrationTargetAccepted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingMigrationTargetProposedIterator is returned from FilterMigrationTargetProposed and is used to iterate over the raw logs and unpacked data for MigrationTargetProposed events raised by the Staking contract. -type StakingMigrationTargetProposedIterator struct { - Event *StakingMigrationTargetProposed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingMigrationTargetProposedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingMigrationTargetProposed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingMigrationTargetProposed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingMigrationTargetProposedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingMigrationTargetProposedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingMigrationTargetProposed represents a MigrationTargetProposed event raised by the Staking contract. -type StakingMigrationTargetProposed struct { - MigrationTarget common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMigrationTargetProposed is a free log retrieval operation binding the contract event 0x5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad3. -// -// Solidity: event MigrationTargetProposed(address migrationTarget) -func (_Staking *StakingFilterer) FilterMigrationTargetProposed(opts *bind.FilterOpts) (*StakingMigrationTargetProposedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "MigrationTargetProposed") - if err != nil { - return nil, err - } - return &StakingMigrationTargetProposedIterator{contract: _Staking.contract, event: "MigrationTargetProposed", logs: logs, sub: sub}, nil -} - -// WatchMigrationTargetProposed is a free log subscription operation binding the contract event 0x5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad3. -// -// Solidity: event MigrationTargetProposed(address migrationTarget) -func (_Staking *StakingFilterer) WatchMigrationTargetProposed(opts *bind.WatchOpts, sink chan<- *StakingMigrationTargetProposed) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "MigrationTargetProposed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingMigrationTargetProposed) - if err := _Staking.contract.UnpackLog(event, "MigrationTargetProposed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMigrationTargetProposed is a log parse operation binding the contract event 0x5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad3. -// -// Solidity: event MigrationTargetProposed(address migrationTarget) -func (_Staking *StakingFilterer) ParseMigrationTargetProposed(log types.Log) (*StakingMigrationTargetProposed, error) { - event := new(StakingMigrationTargetProposed) - if err := _Staking.contract.UnpackLog(event, "MigrationTargetProposed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingOwnershipTransferRequestedIterator is returned from FilterOwnershipTransferRequested and is used to iterate over the raw logs and unpacked data for OwnershipTransferRequested events raised by the Staking contract. -type StakingOwnershipTransferRequestedIterator struct { - Event *StakingOwnershipTransferRequested // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingOwnershipTransferRequestedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingOwnershipTransferRequested represents a OwnershipTransferRequested event raised by the Staking contract. -type StakingOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferRequested is a free log retrieval operation binding the contract event 0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278. -// -// Solidity: event OwnershipTransferRequested(address indexed from, address indexed to) -func (_Staking *StakingFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingOwnershipTransferRequestedIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Staking.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &StakingOwnershipTransferRequestedIterator{contract: _Staking.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferRequested is a free log subscription operation binding the contract event 0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278. -// -// Solidity: event OwnershipTransferRequested(address indexed from, address indexed to) -func (_Staking *StakingFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *StakingOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Staking.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingOwnershipTransferRequested) - if err := _Staking.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferRequested is a log parse operation binding the contract event 0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278. -// -// Solidity: event OwnershipTransferRequested(address indexed from, address indexed to) -func (_Staking *StakingFilterer) ParseOwnershipTransferRequested(log types.Log) (*StakingOwnershipTransferRequested, error) { - event := new(StakingOwnershipTransferRequested) - if err := _Staking.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Staking contract. -type StakingOwnershipTransferredIterator struct { - Event *StakingOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingOwnershipTransferred represents a OwnershipTransferred event raised by the Staking contract. -type StakingOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed from, address indexed to) -func (_Staking *StakingFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingOwnershipTransferredIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Staking.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &StakingOwnershipTransferredIterator{contract: _Staking.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed from, address indexed to) -func (_Staking *StakingFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StakingOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Staking.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingOwnershipTransferred) - if err := _Staking.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed from, address indexed to) -func (_Staking *StakingFilterer) ParseOwnershipTransferred(log types.Log) (*StakingOwnershipTransferred, error) { - event := new(StakingOwnershipTransferred) - if err := _Staking.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingPausedIterator is returned from FilterPaused and is used to iterate over the raw logs and unpacked data for Paused events raised by the Staking contract. -type StakingPausedIterator struct { - Event *StakingPaused // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingPausedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingPaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingPaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingPausedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingPausedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingPaused represents a Paused event raised by the Staking contract. -type StakingPaused struct { - Account common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterPaused is a free log retrieval operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. -// -// Solidity: event Paused(address account) -func (_Staking *StakingFilterer) FilterPaused(opts *bind.FilterOpts) (*StakingPausedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "Paused") - if err != nil { - return nil, err - } - return &StakingPausedIterator{contract: _Staking.contract, event: "Paused", logs: logs, sub: sub}, nil -} - -// WatchPaused is a free log subscription operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. -// -// Solidity: event Paused(address account) -func (_Staking *StakingFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *StakingPaused) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "Paused") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingPaused) - if err := _Staking.contract.UnpackLog(event, "Paused", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParsePaused is a log parse operation binding the contract event 0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258. -// -// Solidity: event Paused(address account) -func (_Staking *StakingFilterer) ParsePaused(log types.Log) (*StakingPaused, error) { - event := new(StakingPaused) - if err := _Staking.contract.UnpackLog(event, "Paused", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingStakedIterator is returned from FilterStaked and is used to iterate over the raw logs and unpacked data for Staked events raised by the Staking contract. -type StakingStakedIterator struct { - Event *StakingStaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingStakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingStakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingStaked represents a Staked event raised by the Staking contract. -type StakingStaked struct { - Staker common.Address - NewStake *big.Int - TotalStake *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterStaked is a free log retrieval operation binding the contract event 0x1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90. -// -// Solidity: event Staked(address staker, uint256 newStake, uint256 totalStake) -func (_Staking *StakingFilterer) FilterStaked(opts *bind.FilterOpts) (*StakingStakedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "Staked") - if err != nil { - return nil, err - } - return &StakingStakedIterator{contract: _Staking.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -// WatchStaked is a free log subscription operation binding the contract event 0x1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90. -// -// Solidity: event Staked(address staker, uint256 newStake, uint256 totalStake) -func (_Staking *StakingFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *StakingStaked) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "Staked") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingStaked) - if err := _Staking.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseStaked is a log parse operation binding the contract event 0x1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90. -// -// Solidity: event Staked(address staker, uint256 newStake, uint256 totalStake) -func (_Staking *StakingFilterer) ParseStaked(log types.Log) (*StakingStaked, error) { - event := new(StakingStaked) - if err := _Staking.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingUnpausedIterator is returned from FilterUnpaused and is used to iterate over the raw logs and unpacked data for Unpaused events raised by the Staking contract. -type StakingUnpausedIterator struct { - Event *StakingUnpaused // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingUnpausedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingUnpaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingUnpaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingUnpausedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingUnpausedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingUnpaused represents a Unpaused event raised by the Staking contract. -type StakingUnpaused struct { - Account common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnpaused is a free log retrieval operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. -// -// Solidity: event Unpaused(address account) -func (_Staking *StakingFilterer) FilterUnpaused(opts *bind.FilterOpts) (*StakingUnpausedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "Unpaused") - if err != nil { - return nil, err - } - return &StakingUnpausedIterator{contract: _Staking.contract, event: "Unpaused", logs: logs, sub: sub}, nil -} - -// WatchUnpaused is a free log subscription operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. -// -// Solidity: event Unpaused(address account) -func (_Staking *StakingFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *StakingUnpaused) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "Unpaused") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingUnpaused) - if err := _Staking.contract.UnpackLog(event, "Unpaused", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnpaused is a log parse operation binding the contract event 0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa. -// -// Solidity: event Unpaused(address account) -func (_Staking *StakingFilterer) ParseUnpaused(log types.Log) (*StakingUnpaused, error) { - event := new(StakingUnpaused) - if err := _Staking.contract.UnpackLog(event, "Unpaused", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// StakingUnstakedIterator is returned from FilterUnstaked and is used to iterate over the raw logs and unpacked data for Unstaked events raised by the Staking contract. -type StakingUnstakedIterator struct { - Event *StakingUnstaked // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *StakingUnstakedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(StakingUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *StakingUnstakedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *StakingUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// StakingUnstaked represents a Unstaked event raised by the Staking contract. -type StakingUnstaked struct { - Staker common.Address - Principal *big.Int - BaseReward *big.Int - DelegationReward *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUnstaked is a free log retrieval operation binding the contract event 0x204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00. -// -// Solidity: event Unstaked(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward) -func (_Staking *StakingFilterer) FilterUnstaked(opts *bind.FilterOpts) (*StakingUnstakedIterator, error) { - - logs, sub, err := _Staking.contract.FilterLogs(opts, "Unstaked") - if err != nil { - return nil, err - } - return &StakingUnstakedIterator{contract: _Staking.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -// WatchUnstaked is a free log subscription operation binding the contract event 0x204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00. -// -// Solidity: event Unstaked(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward) -func (_Staking *StakingFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *StakingUnstaked) (event.Subscription, error) { - - logs, sub, err := _Staking.contract.WatchLogs(opts, "Unstaked") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(StakingUnstaked) - if err := _Staking.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseUnstaked is a log parse operation binding the contract event 0x204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00. -// -// Solidity: event Unstaked(address staker, uint256 principal, uint256 baseReward, uint256 delegationReward) -func (_Staking *StakingFilterer) ParseUnstaked(log types.Log) (*StakingUnstaked, error) { - event := new(StakingUnstaked) - if err := _Staking.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/integration-tests/contracts/ethereum/StakingEventsMock.go b/integration-tests/contracts/ethereum/StakingEventsMock.go deleted file mode 100644 index 2c60949cf0c..00000000000 --- a/integration-tests/contracts/ethereum/StakingEventsMock.go +++ /dev/null @@ -1,3676 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package ethereum - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -var StakingEventsMockMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"alerter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"AlertRaised\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"feedOperators\",\"type\":\"address[]\"}],\"name\":\"FeedOperatorsSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxStakeAmount\",\"type\":\"uint256\"}],\"name\":\"MaxCommunityStakeAmountIncreased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxStakeAmount\",\"type\":\"uint256\"}],\"name\":\"MaxOperatorStakeAmountIncreased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"MerkleRootChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Migrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"MigrationTargetAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"MigrationTargetProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"OperatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"OperatorRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"PoolConcluded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"PoolOpened\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxPoolSize\",\"type\":\"uint256\"}],\"name\":\"PoolSizeIncreased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"}],\"name\":\"RewardAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"available\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"}],\"name\":\"RewardInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"RewardRateChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"operator\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"slashedBaseRewards\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"slashedDelegatedRewards\",\"type\":\"uint256[]\"}],\"name\":\"RewardSlashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStake\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"alerter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"roundId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"}],\"name\":\"emitAlertRaised\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"feedOperators\",\"type\":\"address[]\"}],\"name\":\"emitFeedOperatorsSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxStakeAmount\",\"type\":\"uint256\"}],\"name\":\"emitMaxCommunityStakeAmountIncreased\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxStakeAmount\",\"type\":\"uint256\"}],\"name\":\"emitMaxOperatorStakeAmountIncreased\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"newMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"emitMerkleRootChanged\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"emitMigrated\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"emitMigrationTargetAccepted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"migrationTarget\",\"type\":\"address\"}],\"name\":\"emitMigrationTargetProposed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"emitOperatorAdded\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"emitOperatorRemoved\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emitOwnershipTransferRequested\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emitOwnershipTransferred\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"emitPaused\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emitPoolConcluded\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emitPoolOpened\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxPoolSize\",\"type\":\"uint256\"}],\"name\":\"emitPoolSizeIncreased\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"}],\"name\":\"emitRewardAdded\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"available\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endTimestamp\",\"type\":\"uint256\"}],\"name\":\"emitRewardInitialized\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"emitRewardRateChanged\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"operator\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"slashedBaseRewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"slashedDelegatedRewards\",\"type\":\"uint256[]\"}],\"name\":\"emitRewardSlashed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"emitRewardWithdrawn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"newStake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalStake\",\"type\":\"uint256\"}],\"name\":\"emitStaked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"emitUnpaused\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"staker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"principal\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseReward\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"delegationReward\",\"type\":\"uint256\"}],\"name\":\"emitUnstaked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610f7b806100206000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c80639ec3ce4b116100e3578063b019b4e81161008c578063f7420bc211610066578063f7420bc214610318578063fa2d7fd01461032b578063fe60093f1461033e57600080fd5b8063b019b4e8146102df578063e0275fae146102f2578063eb6289de1461030557600080fd5b8063ab8711bc116100bd578063ab8711bc146102b1578063add49a96146102c4578063aeac9600146102cc57600080fd5b80639ec3ce4b146102785780639f676e9f1461028b578063a5f3d6831461029e57600080fd5b80637be5c756116101455780639a8d2df71161011f5780639a8d2df71461023f5780639b022d73146102525780639e81ace31461026557600080fd5b80637be5c756146102065780637e31a64b146102195780639652ab7b1461022c57600080fd5b80632752e639116101765780632752e639146101d85780633e8f1e05146101eb5780635d21e09a146101f357600080fd5b8063086c1c4a1461019d5780631351da48146101b257806313c664e8146101c5575b600080fd5b6101b06101ab366004610b25565b610351565b005b6101b06101c0366004610a73565b6103b6565b6101b06101d3366004610d04565b610403565b6101b06101e6366004610b5e565b610433565b6101b0610479565b6101b0610201366004610d04565b6104a4565b6101b0610214366004610a73565b6104d4565b6101b0610227366004610d04565b61051a565b6101b061023a366004610a73565b61054a565b6101b061024d366004610a73565b610590565b6101b0610260366004610d04565b6105d6565b6101b0610273366004610c7c565b610606565b6101b0610286366004610a73565b610645565b6101b0610299366004610d1d565b61068b565b6101b06102ac366004610c3f565b6106d0565b6101b06102bf366004610af2565b6106ff565b6101b0610753565b6101b06102da366004610d04565b61077e565b6101b06102ed366004610a95565b6107ae565b6101b0610300366004610af2565b61080c565b6101b0610313366004610ac8565b610860565b6101b0610326366004610a95565b6108b3565b6101b0610339366004610d04565b610911565b6101b061034c366004610d04565b610941565b6040805173ffffffffffffffffffffffffffffffffffffffff8616815260208101859052908101839052606081018290527f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00906080015b60405180910390a150505050565b60405173ffffffffffffffffffffffffffffffffffffffff821681527fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d906020015b60405180910390a150565b6040518181527f816587cb2e773af4f3689a03d7520fabff3462605ded374b485b13994c0d7b52906020016103f8565b7f667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434858585858560405161046a959493929190610dd0565b60405180910390a15050505050565b6040517fded6ebf04e261e1eb2f3e3b268a2e6aee5b478c15b341eba5cf18b9bc80c2e6390600090a1565b6040518181527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d906020016103f8565b60405173ffffffffffffffffffffffffffffffffffffffff821681527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258906020016103f8565b6040518181527fb5f554e5ef00806bace1edbb84186512ebcefa2af7706085143f501f29314df7906020016103f8565b60405173ffffffffffffffffffffffffffffffffffffffff821681527ffa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd84906020016103f8565b60405173ffffffffffffffffffffffffffffffffffffffff821681527f5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad3906020016103f8565b6040518181527f7f4f497e086b2eb55f8a9885ba00d33399bbe0ebcb92ea092834386435a1b9c0906020016103f8565b7e635ea9da6e262e92bb713d71840af7c567807ff35bf73e927490c61283248083838360405161063893929190610e89565b60405180910390a1505050565b60405173ffffffffffffffffffffffffffffffffffffffff821681527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020016103f8565b6040805185815260208101859052908101839052606081018290527f125fc8494f786b470e3c39d0932a62e9e09e291ebd81ea19c57604f6d2b1d167906080016103a8565b7f40aed8e423b39a56b445ae160f4c071fc2cfb48ee0b6dcd5ffeb6bc5b18d10d0816040516103f89190610e76565b6040805173ffffffffffffffffffffffffffffffffffffffff85168152602081018490529081018290527f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9090606001610638565b6040517ff7d0e0f15586495da8c687328ead30fb829d9da55538cb0ef73dd229e517cdb890600090a1565b6040518181527f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c906020016103f8565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6040805173ffffffffffffffffffffffffffffffffffffffff85168152602081018490529081018290527fd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd90606001610638565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f2360404a74478febece1a14f11275f22ada88d19ef96f7d785913010bfff4479910160405180910390a15050565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a35050565b6040518181527f150a6ec0e6f4e9ddcaaaa1674f157d91165a42d60653016f87a9fc870a39f050906020016103f8565b6040518181527f1e3be2efa25bca5bff2215c7b30b31086e703d6aa7d9b9a1f8ba62c5291219ad906020016103f8565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099557600080fd5b919050565b600082601f8301126109ab57600080fd5b813560206109c06109bb83610f1b565b610ecc565b80838252828201915082860187848660051b89010111156109e057600080fd5b60005b85811015610a06576109f482610971565b845292840192908401906001016109e3565b5090979650505050505050565b600082601f830112610a2457600080fd5b81356020610a346109bb83610f1b565b80838252828201915082860187848660051b8901011115610a5457600080fd5b60005b85811015610a0657813584529284019290840190600101610a57565b600060208284031215610a8557600080fd5b610a8e82610971565b9392505050565b60008060408385031215610aa857600080fd5b610ab183610971565b9150610abf60208401610971565b90509250929050565b60008060408385031215610adb57600080fd5b610ae483610971565b946020939093013593505050565b600080600060608486031215610b0757600080fd5b610b1084610971565b95602085013595506040909401359392505050565b60008060008060808587031215610b3b57600080fd5b610b4485610971565b966020860135965060408601359560600135945092505050565b600080600080600060a08688031215610b7657600080fd5b610b7f86610971565b945060208087013594506040870135935060608701359250608087013567ffffffffffffffff80821115610bb257600080fd5b818901915089601f830112610bc657600080fd5b813581811115610bd857610bd8610f3f565b610c08847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610ecc565b91508082528a84828501011115610c1e57600080fd5b80848401858401376000848284010152508093505050509295509295909350565b600060208284031215610c5157600080fd5b813567ffffffffffffffff811115610c6857600080fd5b610c748482850161099a565b949350505050565b600080600060608486031215610c9157600080fd5b833567ffffffffffffffff80821115610ca957600080fd5b610cb58783880161099a565b94506020860135915080821115610ccb57600080fd5b610cd787838801610a13565b93506040860135915080821115610ced57600080fd5b50610cfa86828701610a13565b9150509250925092565b600060208284031215610d1657600080fd5b5035919050565b60008060008060808587031215610d3357600080fd5b5050823594602084013594506040840135936060013592509050565b600081518084526020808501945080840160005b83811015610d9557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101610d63565b509495945050505050565b600081518084526020808501945080840160005b83811015610d9557815187529582019590820190600101610db4565b73ffffffffffffffffffffffffffffffffffffffff8616815260006020868184015285604084015284606084015260a0608084015283518060a085015260005b81811015610e2c5785810183015185820160c001528201610e10565b81811115610e3e57600060c083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160c001979650505050505050565b602081526000610a8e6020830184610d4f565b606081526000610e9c6060830186610d4f565b8281036020840152610eae8186610da0565b90508281036040840152610ec28185610da0565b9695505050505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610f1357610f13610f3f565b604052919050565b600067ffffffffffffffff821115610f3557610f35610f3f565b5060051b60200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c6343000806000a", -} - -var StakingEventsMockABI = StakingEventsMockMetaData.ABI - -var StakingEventsMockBin = StakingEventsMockMetaData.Bin - -func DeployStakingEventsMock(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *StakingEventsMock, error) { - parsed, err := StakingEventsMockMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(StakingEventsMockBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &StakingEventsMock{StakingEventsMockCaller: StakingEventsMockCaller{contract: contract}, StakingEventsMockTransactor: StakingEventsMockTransactor{contract: contract}, StakingEventsMockFilterer: StakingEventsMockFilterer{contract: contract}}, nil -} - -type StakingEventsMock struct { - address common.Address - abi abi.ABI - StakingEventsMockCaller - StakingEventsMockTransactor - StakingEventsMockFilterer -} - -type StakingEventsMockCaller struct { - contract *bind.BoundContract -} - -type StakingEventsMockTransactor struct { - contract *bind.BoundContract -} - -type StakingEventsMockFilterer struct { - contract *bind.BoundContract -} - -type StakingEventsMockSession struct { - Contract *StakingEventsMock - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type StakingEventsMockCallerSession struct { - Contract *StakingEventsMockCaller - CallOpts bind.CallOpts -} - -type StakingEventsMockTransactorSession struct { - Contract *StakingEventsMockTransactor - TransactOpts bind.TransactOpts -} - -type StakingEventsMockRaw struct { - Contract *StakingEventsMock -} - -type StakingEventsMockCallerRaw struct { - Contract *StakingEventsMockCaller -} - -type StakingEventsMockTransactorRaw struct { - Contract *StakingEventsMockTransactor -} - -func NewStakingEventsMock(address common.Address, backend bind.ContractBackend) (*StakingEventsMock, error) { - abi, err := abi.JSON(strings.NewReader(StakingEventsMockABI)) - if err != nil { - return nil, err - } - contract, err := bindStakingEventsMock(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &StakingEventsMock{address: address, abi: abi, StakingEventsMockCaller: StakingEventsMockCaller{contract: contract}, StakingEventsMockTransactor: StakingEventsMockTransactor{contract: contract}, StakingEventsMockFilterer: StakingEventsMockFilterer{contract: contract}}, nil -} - -func NewStakingEventsMockCaller(address common.Address, caller bind.ContractCaller) (*StakingEventsMockCaller, error) { - contract, err := bindStakingEventsMock(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &StakingEventsMockCaller{contract: contract}, nil -} - -func NewStakingEventsMockTransactor(address common.Address, transactor bind.ContractTransactor) (*StakingEventsMockTransactor, error) { - contract, err := bindStakingEventsMock(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &StakingEventsMockTransactor{contract: contract}, nil -} - -func NewStakingEventsMockFilterer(address common.Address, filterer bind.ContractFilterer) (*StakingEventsMockFilterer, error) { - contract, err := bindStakingEventsMock(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &StakingEventsMockFilterer{contract: contract}, nil -} - -func bindStakingEventsMock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := StakingEventsMockMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_StakingEventsMock *StakingEventsMockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingEventsMock.Contract.StakingEventsMockCaller.contract.Call(opts, result, method, params...) -} - -func (_StakingEventsMock *StakingEventsMockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingEventsMock.Contract.StakingEventsMockTransactor.contract.Transfer(opts) -} - -func (_StakingEventsMock *StakingEventsMockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingEventsMock.Contract.StakingEventsMockTransactor.contract.Transact(opts, method, params...) -} - -func (_StakingEventsMock *StakingEventsMockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _StakingEventsMock.Contract.contract.Call(opts, result, method, params...) -} - -func (_StakingEventsMock *StakingEventsMockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingEventsMock.Contract.contract.Transfer(opts) -} - -func (_StakingEventsMock *StakingEventsMockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _StakingEventsMock.Contract.contract.Transact(opts, method, params...) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitAlertRaised(opts *bind.TransactOpts, alerter common.Address, roundId *big.Int, rewardAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitAlertRaised", alerter, roundId, rewardAmount) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitAlertRaised(alerter common.Address, roundId *big.Int, rewardAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitAlertRaised(&_StakingEventsMock.TransactOpts, alerter, roundId, rewardAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitAlertRaised(alerter common.Address, roundId *big.Int, rewardAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitAlertRaised(&_StakingEventsMock.TransactOpts, alerter, roundId, rewardAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitFeedOperatorsSet(opts *bind.TransactOpts, feedOperators []common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitFeedOperatorsSet", feedOperators) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitFeedOperatorsSet(feedOperators []common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitFeedOperatorsSet(&_StakingEventsMock.TransactOpts, feedOperators) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitFeedOperatorsSet(feedOperators []common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitFeedOperatorsSet(&_StakingEventsMock.TransactOpts, feedOperators) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMaxCommunityStakeAmountIncreased(opts *bind.TransactOpts, maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMaxCommunityStakeAmountIncreased", maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMaxCommunityStakeAmountIncreased(maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMaxCommunityStakeAmountIncreased(&_StakingEventsMock.TransactOpts, maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMaxCommunityStakeAmountIncreased(maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMaxCommunityStakeAmountIncreased(&_StakingEventsMock.TransactOpts, maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMaxOperatorStakeAmountIncreased(opts *bind.TransactOpts, maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMaxOperatorStakeAmountIncreased", maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMaxOperatorStakeAmountIncreased(maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMaxOperatorStakeAmountIncreased(&_StakingEventsMock.TransactOpts, maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMaxOperatorStakeAmountIncreased(maxStakeAmount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMaxOperatorStakeAmountIncreased(&_StakingEventsMock.TransactOpts, maxStakeAmount) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMerkleRootChanged(opts *bind.TransactOpts, newMerkleRoot [32]byte) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMerkleRootChanged", newMerkleRoot) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMerkleRootChanged(newMerkleRoot [32]byte) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMerkleRootChanged(&_StakingEventsMock.TransactOpts, newMerkleRoot) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMerkleRootChanged(newMerkleRoot [32]byte) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMerkleRootChanged(&_StakingEventsMock.TransactOpts, newMerkleRoot) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMigrated(opts *bind.TransactOpts, staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int, data []byte) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMigrated", staker, principal, baseReward, delegationReward, data) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMigrated(staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int, data []byte) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrated(&_StakingEventsMock.TransactOpts, staker, principal, baseReward, delegationReward, data) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMigrated(staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int, data []byte) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrated(&_StakingEventsMock.TransactOpts, staker, principal, baseReward, delegationReward, data) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMigrationTargetAccepted(opts *bind.TransactOpts, migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMigrationTargetAccepted", migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMigrationTargetAccepted(migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrationTargetAccepted(&_StakingEventsMock.TransactOpts, migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMigrationTargetAccepted(migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrationTargetAccepted(&_StakingEventsMock.TransactOpts, migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitMigrationTargetProposed(opts *bind.TransactOpts, migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitMigrationTargetProposed", migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitMigrationTargetProposed(migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrationTargetProposed(&_StakingEventsMock.TransactOpts, migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitMigrationTargetProposed(migrationTarget common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitMigrationTargetProposed(&_StakingEventsMock.TransactOpts, migrationTarget) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitOperatorAdded(opts *bind.TransactOpts, operator common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitOperatorAdded", operator) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitOperatorAdded(operator common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOperatorAdded(&_StakingEventsMock.TransactOpts, operator) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitOperatorAdded(operator common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOperatorAdded(&_StakingEventsMock.TransactOpts, operator) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitOperatorRemoved(opts *bind.TransactOpts, operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitOperatorRemoved", operator, amount) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitOperatorRemoved(operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOperatorRemoved(&_StakingEventsMock.TransactOpts, operator, amount) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitOperatorRemoved(operator common.Address, amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOperatorRemoved(&_StakingEventsMock.TransactOpts, operator, amount) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitOwnershipTransferRequested(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitOwnershipTransferRequested", from, to) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitOwnershipTransferRequested(from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOwnershipTransferRequested(&_StakingEventsMock.TransactOpts, from, to) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitOwnershipTransferRequested(from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOwnershipTransferRequested(&_StakingEventsMock.TransactOpts, from, to) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitOwnershipTransferred(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitOwnershipTransferred", from, to) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitOwnershipTransferred(from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOwnershipTransferred(&_StakingEventsMock.TransactOpts, from, to) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitOwnershipTransferred(from common.Address, to common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitOwnershipTransferred(&_StakingEventsMock.TransactOpts, from, to) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitPaused(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitPaused", account) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitPaused(account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPaused(&_StakingEventsMock.TransactOpts, account) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitPaused(account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPaused(&_StakingEventsMock.TransactOpts, account) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitPoolConcluded(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitPoolConcluded") -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitPoolConcluded() (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolConcluded(&_StakingEventsMock.TransactOpts) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitPoolConcluded() (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolConcluded(&_StakingEventsMock.TransactOpts) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitPoolOpened(opts *bind.TransactOpts) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitPoolOpened") -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitPoolOpened() (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolOpened(&_StakingEventsMock.TransactOpts) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitPoolOpened() (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolOpened(&_StakingEventsMock.TransactOpts) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitPoolSizeIncreased(opts *bind.TransactOpts, maxPoolSize *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitPoolSizeIncreased", maxPoolSize) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitPoolSizeIncreased(maxPoolSize *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolSizeIncreased(&_StakingEventsMock.TransactOpts, maxPoolSize) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitPoolSizeIncreased(maxPoolSize *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitPoolSizeIncreased(&_StakingEventsMock.TransactOpts, maxPoolSize) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitRewardAdded(opts *bind.TransactOpts, amountAdded *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitRewardAdded", amountAdded) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitRewardAdded(amountAdded *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardAdded(&_StakingEventsMock.TransactOpts, amountAdded) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitRewardAdded(amountAdded *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardAdded(&_StakingEventsMock.TransactOpts, amountAdded) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitRewardInitialized(opts *bind.TransactOpts, rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitRewardInitialized", rate, available, startTimestamp, endTimestamp) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitRewardInitialized(rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardInitialized(&_StakingEventsMock.TransactOpts, rate, available, startTimestamp, endTimestamp) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitRewardInitialized(rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardInitialized(&_StakingEventsMock.TransactOpts, rate, available, startTimestamp, endTimestamp) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitRewardRateChanged(opts *bind.TransactOpts, rate *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitRewardRateChanged", rate) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitRewardRateChanged(rate *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardRateChanged(&_StakingEventsMock.TransactOpts, rate) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitRewardRateChanged(rate *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardRateChanged(&_StakingEventsMock.TransactOpts, rate) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitRewardSlashed(opts *bind.TransactOpts, operator []common.Address, slashedBaseRewards []*big.Int, slashedDelegatedRewards []*big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitRewardSlashed", operator, slashedBaseRewards, slashedDelegatedRewards) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitRewardSlashed(operator []common.Address, slashedBaseRewards []*big.Int, slashedDelegatedRewards []*big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardSlashed(&_StakingEventsMock.TransactOpts, operator, slashedBaseRewards, slashedDelegatedRewards) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitRewardSlashed(operator []common.Address, slashedBaseRewards []*big.Int, slashedDelegatedRewards []*big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardSlashed(&_StakingEventsMock.TransactOpts, operator, slashedBaseRewards, slashedDelegatedRewards) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitRewardWithdrawn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitRewardWithdrawn", amount) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitRewardWithdrawn(amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardWithdrawn(&_StakingEventsMock.TransactOpts, amount) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitRewardWithdrawn(amount *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitRewardWithdrawn(&_StakingEventsMock.TransactOpts, amount) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitStaked(opts *bind.TransactOpts, staker common.Address, newStake *big.Int, totalStake *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitStaked", staker, newStake, totalStake) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitStaked(staker common.Address, newStake *big.Int, totalStake *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitStaked(&_StakingEventsMock.TransactOpts, staker, newStake, totalStake) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitStaked(staker common.Address, newStake *big.Int, totalStake *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitStaked(&_StakingEventsMock.TransactOpts, staker, newStake, totalStake) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitUnpaused(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitUnpaused", account) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitUnpaused(account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitUnpaused(&_StakingEventsMock.TransactOpts, account) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitUnpaused(account common.Address) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitUnpaused(&_StakingEventsMock.TransactOpts, account) -} - -func (_StakingEventsMock *StakingEventsMockTransactor) EmitUnstaked(opts *bind.TransactOpts, staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.contract.Transact(opts, "emitUnstaked", staker, principal, baseReward, delegationReward) -} - -func (_StakingEventsMock *StakingEventsMockSession) EmitUnstaked(staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitUnstaked(&_StakingEventsMock.TransactOpts, staker, principal, baseReward, delegationReward) -} - -func (_StakingEventsMock *StakingEventsMockTransactorSession) EmitUnstaked(staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int) (*types.Transaction, error) { - return _StakingEventsMock.Contract.EmitUnstaked(&_StakingEventsMock.TransactOpts, staker, principal, baseReward, delegationReward) -} - -type StakingEventsMockAlertRaisedIterator struct { - Event *StakingEventsMockAlertRaised - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockAlertRaisedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockAlertRaised) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockAlertRaised) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockAlertRaisedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockAlertRaisedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockAlertRaised struct { - Alerter common.Address - RoundId *big.Int - RewardAmount *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterAlertRaised(opts *bind.FilterOpts) (*StakingEventsMockAlertRaisedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "AlertRaised") - if err != nil { - return nil, err - } - return &StakingEventsMockAlertRaisedIterator{contract: _StakingEventsMock.contract, event: "AlertRaised", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchAlertRaised(opts *bind.WatchOpts, sink chan<- *StakingEventsMockAlertRaised) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "AlertRaised") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockAlertRaised) - if err := _StakingEventsMock.contract.UnpackLog(event, "AlertRaised", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseAlertRaised(log types.Log) (*StakingEventsMockAlertRaised, error) { - event := new(StakingEventsMockAlertRaised) - if err := _StakingEventsMock.contract.UnpackLog(event, "AlertRaised", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockFeedOperatorsSetIterator struct { - Event *StakingEventsMockFeedOperatorsSet - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockFeedOperatorsSetIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockFeedOperatorsSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockFeedOperatorsSet) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockFeedOperatorsSetIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockFeedOperatorsSetIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockFeedOperatorsSet struct { - FeedOperators []common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterFeedOperatorsSet(opts *bind.FilterOpts) (*StakingEventsMockFeedOperatorsSetIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "FeedOperatorsSet") - if err != nil { - return nil, err - } - return &StakingEventsMockFeedOperatorsSetIterator{contract: _StakingEventsMock.contract, event: "FeedOperatorsSet", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchFeedOperatorsSet(opts *bind.WatchOpts, sink chan<- *StakingEventsMockFeedOperatorsSet) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "FeedOperatorsSet") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockFeedOperatorsSet) - if err := _StakingEventsMock.contract.UnpackLog(event, "FeedOperatorsSet", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseFeedOperatorsSet(log types.Log) (*StakingEventsMockFeedOperatorsSet, error) { - event := new(StakingEventsMockFeedOperatorsSet) - if err := _StakingEventsMock.contract.UnpackLog(event, "FeedOperatorsSet", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMaxCommunityStakeAmountIncreasedIterator struct { - Event *StakingEventsMockMaxCommunityStakeAmountIncreased - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMaxCommunityStakeAmountIncreasedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMaxCommunityStakeAmountIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMaxCommunityStakeAmountIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMaxCommunityStakeAmountIncreasedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMaxCommunityStakeAmountIncreasedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMaxCommunityStakeAmountIncreased struct { - MaxStakeAmount *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMaxCommunityStakeAmountIncreased(opts *bind.FilterOpts) (*StakingEventsMockMaxCommunityStakeAmountIncreasedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "MaxCommunityStakeAmountIncreased") - if err != nil { - return nil, err - } - return &StakingEventsMockMaxCommunityStakeAmountIncreasedIterator{contract: _StakingEventsMock.contract, event: "MaxCommunityStakeAmountIncreased", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMaxCommunityStakeAmountIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMaxCommunityStakeAmountIncreased) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "MaxCommunityStakeAmountIncreased") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMaxCommunityStakeAmountIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "MaxCommunityStakeAmountIncreased", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMaxCommunityStakeAmountIncreased(log types.Log) (*StakingEventsMockMaxCommunityStakeAmountIncreased, error) { - event := new(StakingEventsMockMaxCommunityStakeAmountIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "MaxCommunityStakeAmountIncreased", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMaxOperatorStakeAmountIncreasedIterator struct { - Event *StakingEventsMockMaxOperatorStakeAmountIncreased - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMaxOperatorStakeAmountIncreasedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMaxOperatorStakeAmountIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMaxOperatorStakeAmountIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMaxOperatorStakeAmountIncreasedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMaxOperatorStakeAmountIncreasedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMaxOperatorStakeAmountIncreased struct { - MaxStakeAmount *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMaxOperatorStakeAmountIncreased(opts *bind.FilterOpts) (*StakingEventsMockMaxOperatorStakeAmountIncreasedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "MaxOperatorStakeAmountIncreased") - if err != nil { - return nil, err - } - return &StakingEventsMockMaxOperatorStakeAmountIncreasedIterator{contract: _StakingEventsMock.contract, event: "MaxOperatorStakeAmountIncreased", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMaxOperatorStakeAmountIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMaxOperatorStakeAmountIncreased) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "MaxOperatorStakeAmountIncreased") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMaxOperatorStakeAmountIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "MaxOperatorStakeAmountIncreased", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMaxOperatorStakeAmountIncreased(log types.Log) (*StakingEventsMockMaxOperatorStakeAmountIncreased, error) { - event := new(StakingEventsMockMaxOperatorStakeAmountIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "MaxOperatorStakeAmountIncreased", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMerkleRootChangedIterator struct { - Event *StakingEventsMockMerkleRootChanged - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMerkleRootChangedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMerkleRootChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMerkleRootChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMerkleRootChangedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMerkleRootChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMerkleRootChanged struct { - NewMerkleRoot [32]byte - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMerkleRootChanged(opts *bind.FilterOpts) (*StakingEventsMockMerkleRootChangedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "MerkleRootChanged") - if err != nil { - return nil, err - } - return &StakingEventsMockMerkleRootChangedIterator{contract: _StakingEventsMock.contract, event: "MerkleRootChanged", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMerkleRootChanged(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMerkleRootChanged) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "MerkleRootChanged") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMerkleRootChanged) - if err := _StakingEventsMock.contract.UnpackLog(event, "MerkleRootChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMerkleRootChanged(log types.Log) (*StakingEventsMockMerkleRootChanged, error) { - event := new(StakingEventsMockMerkleRootChanged) - if err := _StakingEventsMock.contract.UnpackLog(event, "MerkleRootChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMigratedIterator struct { - Event *StakingEventsMockMigrated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMigratedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMigratedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMigratedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMigrated struct { - Staker common.Address - Principal *big.Int - BaseReward *big.Int - DelegationReward *big.Int - Data []byte - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMigrated(opts *bind.FilterOpts) (*StakingEventsMockMigratedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "Migrated") - if err != nil { - return nil, err - } - return &StakingEventsMockMigratedIterator{contract: _StakingEventsMock.contract, event: "Migrated", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMigrated(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrated) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "Migrated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMigrated) - if err := _StakingEventsMock.contract.UnpackLog(event, "Migrated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMigrated(log types.Log) (*StakingEventsMockMigrated, error) { - event := new(StakingEventsMockMigrated) - if err := _StakingEventsMock.contract.UnpackLog(event, "Migrated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMigrationTargetAcceptedIterator struct { - Event *StakingEventsMockMigrationTargetAccepted - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMigrationTargetAcceptedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrationTargetAccepted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrationTargetAccepted) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMigrationTargetAcceptedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMigrationTargetAcceptedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMigrationTargetAccepted struct { - MigrationTarget common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMigrationTargetAccepted(opts *bind.FilterOpts) (*StakingEventsMockMigrationTargetAcceptedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "MigrationTargetAccepted") - if err != nil { - return nil, err - } - return &StakingEventsMockMigrationTargetAcceptedIterator{contract: _StakingEventsMock.contract, event: "MigrationTargetAccepted", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMigrationTargetAccepted(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrationTargetAccepted) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "MigrationTargetAccepted") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMigrationTargetAccepted) - if err := _StakingEventsMock.contract.UnpackLog(event, "MigrationTargetAccepted", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMigrationTargetAccepted(log types.Log) (*StakingEventsMockMigrationTargetAccepted, error) { - event := new(StakingEventsMockMigrationTargetAccepted) - if err := _StakingEventsMock.contract.UnpackLog(event, "MigrationTargetAccepted", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockMigrationTargetProposedIterator struct { - Event *StakingEventsMockMigrationTargetProposed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockMigrationTargetProposedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrationTargetProposed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockMigrationTargetProposed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockMigrationTargetProposedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockMigrationTargetProposedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockMigrationTargetProposed struct { - MigrationTarget common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterMigrationTargetProposed(opts *bind.FilterOpts) (*StakingEventsMockMigrationTargetProposedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "MigrationTargetProposed") - if err != nil { - return nil, err - } - return &StakingEventsMockMigrationTargetProposedIterator{contract: _StakingEventsMock.contract, event: "MigrationTargetProposed", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchMigrationTargetProposed(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrationTargetProposed) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "MigrationTargetProposed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockMigrationTargetProposed) - if err := _StakingEventsMock.contract.UnpackLog(event, "MigrationTargetProposed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseMigrationTargetProposed(log types.Log) (*StakingEventsMockMigrationTargetProposed, error) { - event := new(StakingEventsMockMigrationTargetProposed) - if err := _StakingEventsMock.contract.UnpackLog(event, "MigrationTargetProposed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockOperatorAddedIterator struct { - Event *StakingEventsMockOperatorAdded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockOperatorAddedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOperatorAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOperatorAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockOperatorAddedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockOperatorAddedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockOperatorAdded struct { - Operator common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterOperatorAdded(opts *bind.FilterOpts) (*StakingEventsMockOperatorAddedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "OperatorAdded") - if err != nil { - return nil, err - } - return &StakingEventsMockOperatorAddedIterator{contract: _StakingEventsMock.contract, event: "OperatorAdded", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchOperatorAdded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOperatorAdded) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "OperatorAdded") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockOperatorAdded) - if err := _StakingEventsMock.contract.UnpackLog(event, "OperatorAdded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseOperatorAdded(log types.Log) (*StakingEventsMockOperatorAdded, error) { - event := new(StakingEventsMockOperatorAdded) - if err := _StakingEventsMock.contract.UnpackLog(event, "OperatorAdded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockOperatorRemovedIterator struct { - Event *StakingEventsMockOperatorRemoved - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockOperatorRemovedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOperatorRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOperatorRemoved) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockOperatorRemovedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockOperatorRemovedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockOperatorRemoved struct { - Operator common.Address - Amount *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterOperatorRemoved(opts *bind.FilterOpts) (*StakingEventsMockOperatorRemovedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "OperatorRemoved") - if err != nil { - return nil, err - } - return &StakingEventsMockOperatorRemovedIterator{contract: _StakingEventsMock.contract, event: "OperatorRemoved", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchOperatorRemoved(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOperatorRemoved) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "OperatorRemoved") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockOperatorRemoved) - if err := _StakingEventsMock.contract.UnpackLog(event, "OperatorRemoved", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseOperatorRemoved(log types.Log) (*StakingEventsMockOperatorRemoved, error) { - event := new(StakingEventsMockOperatorRemoved) - if err := _StakingEventsMock.contract.UnpackLog(event, "OperatorRemoved", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockOwnershipTransferRequestedIterator struct { - Event *StakingEventsMockOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingEventsMockOwnershipTransferRequestedIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &StakingEventsMockOwnershipTransferRequestedIterator{contract: _StakingEventsMock.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockOwnershipTransferRequested) - if err := _StakingEventsMock.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseOwnershipTransferRequested(log types.Log) (*StakingEventsMockOwnershipTransferRequested, error) { - event := new(StakingEventsMockOwnershipTransferRequested) - if err := _StakingEventsMock.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockOwnershipTransferredIterator struct { - Event *StakingEventsMockOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingEventsMockOwnershipTransferredIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &StakingEventsMockOwnershipTransferredIterator{contract: _StakingEventsMock.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockOwnershipTransferred) - if err := _StakingEventsMock.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseOwnershipTransferred(log types.Log) (*StakingEventsMockOwnershipTransferred, error) { - event := new(StakingEventsMockOwnershipTransferred) - if err := _StakingEventsMock.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockPausedIterator struct { - Event *StakingEventsMockPaused - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockPausedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockPausedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockPausedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockPaused struct { - Account common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterPaused(opts *bind.FilterOpts) (*StakingEventsMockPausedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "Paused") - if err != nil { - return nil, err - } - return &StakingEventsMockPausedIterator{contract: _StakingEventsMock.contract, event: "Paused", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchPaused(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPaused) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "Paused") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockPaused) - if err := _StakingEventsMock.contract.UnpackLog(event, "Paused", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParsePaused(log types.Log) (*StakingEventsMockPaused, error) { - event := new(StakingEventsMockPaused) - if err := _StakingEventsMock.contract.UnpackLog(event, "Paused", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockPoolConcludedIterator struct { - Event *StakingEventsMockPoolConcluded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockPoolConcludedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolConcluded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolConcluded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockPoolConcludedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockPoolConcludedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockPoolConcluded struct { - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterPoolConcluded(opts *bind.FilterOpts) (*StakingEventsMockPoolConcludedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "PoolConcluded") - if err != nil { - return nil, err - } - return &StakingEventsMockPoolConcludedIterator{contract: _StakingEventsMock.contract, event: "PoolConcluded", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchPoolConcluded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolConcluded) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "PoolConcluded") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockPoolConcluded) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolConcluded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParsePoolConcluded(log types.Log) (*StakingEventsMockPoolConcluded, error) { - event := new(StakingEventsMockPoolConcluded) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolConcluded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockPoolOpenedIterator struct { - Event *StakingEventsMockPoolOpened - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockPoolOpenedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolOpened) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolOpened) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockPoolOpenedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockPoolOpenedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockPoolOpened struct { - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterPoolOpened(opts *bind.FilterOpts) (*StakingEventsMockPoolOpenedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "PoolOpened") - if err != nil { - return nil, err - } - return &StakingEventsMockPoolOpenedIterator{contract: _StakingEventsMock.contract, event: "PoolOpened", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchPoolOpened(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolOpened) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "PoolOpened") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockPoolOpened) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolOpened", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParsePoolOpened(log types.Log) (*StakingEventsMockPoolOpened, error) { - event := new(StakingEventsMockPoolOpened) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolOpened", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockPoolSizeIncreasedIterator struct { - Event *StakingEventsMockPoolSizeIncreased - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockPoolSizeIncreasedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolSizeIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockPoolSizeIncreased) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockPoolSizeIncreasedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockPoolSizeIncreasedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockPoolSizeIncreased struct { - MaxPoolSize *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterPoolSizeIncreased(opts *bind.FilterOpts) (*StakingEventsMockPoolSizeIncreasedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "PoolSizeIncreased") - if err != nil { - return nil, err - } - return &StakingEventsMockPoolSizeIncreasedIterator{contract: _StakingEventsMock.contract, event: "PoolSizeIncreased", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchPoolSizeIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolSizeIncreased) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "PoolSizeIncreased") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockPoolSizeIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolSizeIncreased", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParsePoolSizeIncreased(log types.Log) (*StakingEventsMockPoolSizeIncreased, error) { - event := new(StakingEventsMockPoolSizeIncreased) - if err := _StakingEventsMock.contract.UnpackLog(event, "PoolSizeIncreased", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockRewardAddedIterator struct { - Event *StakingEventsMockRewardAdded - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockRewardAddedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardAdded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockRewardAddedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockRewardAddedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockRewardAdded struct { - AmountAdded *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterRewardAdded(opts *bind.FilterOpts) (*StakingEventsMockRewardAddedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "RewardAdded") - if err != nil { - return nil, err - } - return &StakingEventsMockRewardAddedIterator{contract: _StakingEventsMock.contract, event: "RewardAdded", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchRewardAdded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardAdded) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "RewardAdded") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockRewardAdded) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardAdded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseRewardAdded(log types.Log) (*StakingEventsMockRewardAdded, error) { - event := new(StakingEventsMockRewardAdded) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardAdded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockRewardInitializedIterator struct { - Event *StakingEventsMockRewardInitialized - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockRewardInitializedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardInitialized) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockRewardInitializedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockRewardInitializedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockRewardInitialized struct { - Rate *big.Int - Available *big.Int - StartTimestamp *big.Int - EndTimestamp *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterRewardInitialized(opts *bind.FilterOpts) (*StakingEventsMockRewardInitializedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "RewardInitialized") - if err != nil { - return nil, err - } - return &StakingEventsMockRewardInitializedIterator{contract: _StakingEventsMock.contract, event: "RewardInitialized", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchRewardInitialized(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardInitialized) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "RewardInitialized") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockRewardInitialized) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardInitialized", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseRewardInitialized(log types.Log) (*StakingEventsMockRewardInitialized, error) { - event := new(StakingEventsMockRewardInitialized) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardInitialized", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockRewardRateChangedIterator struct { - Event *StakingEventsMockRewardRateChanged - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockRewardRateChangedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardRateChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardRateChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockRewardRateChangedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockRewardRateChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockRewardRateChanged struct { - Rate *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterRewardRateChanged(opts *bind.FilterOpts) (*StakingEventsMockRewardRateChangedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "RewardRateChanged") - if err != nil { - return nil, err - } - return &StakingEventsMockRewardRateChangedIterator{contract: _StakingEventsMock.contract, event: "RewardRateChanged", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchRewardRateChanged(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardRateChanged) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "RewardRateChanged") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockRewardRateChanged) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardRateChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseRewardRateChanged(log types.Log) (*StakingEventsMockRewardRateChanged, error) { - event := new(StakingEventsMockRewardRateChanged) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardRateChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockRewardSlashedIterator struct { - Event *StakingEventsMockRewardSlashed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockRewardSlashedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardSlashed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardSlashed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockRewardSlashedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockRewardSlashedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockRewardSlashed struct { - Operator []common.Address - SlashedBaseRewards []*big.Int - SlashedDelegatedRewards []*big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterRewardSlashed(opts *bind.FilterOpts) (*StakingEventsMockRewardSlashedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "RewardSlashed") - if err != nil { - return nil, err - } - return &StakingEventsMockRewardSlashedIterator{contract: _StakingEventsMock.contract, event: "RewardSlashed", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchRewardSlashed(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardSlashed) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "RewardSlashed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockRewardSlashed) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardSlashed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseRewardSlashed(log types.Log) (*StakingEventsMockRewardSlashed, error) { - event := new(StakingEventsMockRewardSlashed) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardSlashed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockRewardWithdrawnIterator struct { - Event *StakingEventsMockRewardWithdrawn - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockRewardWithdrawnIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockRewardWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockRewardWithdrawnIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockRewardWithdrawnIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockRewardWithdrawn struct { - Amount *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterRewardWithdrawn(opts *bind.FilterOpts) (*StakingEventsMockRewardWithdrawnIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "RewardWithdrawn") - if err != nil { - return nil, err - } - return &StakingEventsMockRewardWithdrawnIterator{contract: _StakingEventsMock.contract, event: "RewardWithdrawn", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchRewardWithdrawn(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardWithdrawn) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "RewardWithdrawn") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockRewardWithdrawn) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardWithdrawn", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseRewardWithdrawn(log types.Log) (*StakingEventsMockRewardWithdrawn, error) { - event := new(StakingEventsMockRewardWithdrawn) - if err := _StakingEventsMock.contract.UnpackLog(event, "RewardWithdrawn", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockStakedIterator struct { - Event *StakingEventsMockStaked - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockStakedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockStaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockStakedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockStakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockStaked struct { - Staker common.Address - NewStake *big.Int - TotalStake *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterStaked(opts *bind.FilterOpts) (*StakingEventsMockStakedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "Staked") - if err != nil { - return nil, err - } - return &StakingEventsMockStakedIterator{contract: _StakingEventsMock.contract, event: "Staked", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchStaked(opts *bind.WatchOpts, sink chan<- *StakingEventsMockStaked) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "Staked") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockStaked) - if err := _StakingEventsMock.contract.UnpackLog(event, "Staked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseStaked(log types.Log) (*StakingEventsMockStaked, error) { - event := new(StakingEventsMockStaked) - if err := _StakingEventsMock.contract.UnpackLog(event, "Staked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockUnpausedIterator struct { - Event *StakingEventsMockUnpaused - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockUnpausedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockUnpaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockUnpaused) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockUnpausedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockUnpausedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockUnpaused struct { - Account common.Address - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterUnpaused(opts *bind.FilterOpts) (*StakingEventsMockUnpausedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "Unpaused") - if err != nil { - return nil, err - } - return &StakingEventsMockUnpausedIterator{contract: _StakingEventsMock.contract, event: "Unpaused", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchUnpaused(opts *bind.WatchOpts, sink chan<- *StakingEventsMockUnpaused) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "Unpaused") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockUnpaused) - if err := _StakingEventsMock.contract.UnpackLog(event, "Unpaused", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseUnpaused(log types.Log) (*StakingEventsMockUnpaused, error) { - event := new(StakingEventsMockUnpaused) - if err := _StakingEventsMock.contract.UnpackLog(event, "Unpaused", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type StakingEventsMockUnstakedIterator struct { - Event *StakingEventsMockUnstaked - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *StakingEventsMockUnstakedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(StakingEventsMockUnstaked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *StakingEventsMockUnstakedIterator) Error() error { - return it.fail -} - -func (it *StakingEventsMockUnstakedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type StakingEventsMockUnstaked struct { - Staker common.Address - Principal *big.Int - BaseReward *big.Int - DelegationReward *big.Int - Raw types.Log -} - -func (_StakingEventsMock *StakingEventsMockFilterer) FilterUnstaked(opts *bind.FilterOpts) (*StakingEventsMockUnstakedIterator, error) { - - logs, sub, err := _StakingEventsMock.contract.FilterLogs(opts, "Unstaked") - if err != nil { - return nil, err - } - return &StakingEventsMockUnstakedIterator{contract: _StakingEventsMock.contract, event: "Unstaked", logs: logs, sub: sub}, nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) WatchUnstaked(opts *bind.WatchOpts, sink chan<- *StakingEventsMockUnstaked) (event.Subscription, error) { - - logs, sub, err := _StakingEventsMock.contract.WatchLogs(opts, "Unstaked") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(StakingEventsMockUnstaked) - if err := _StakingEventsMock.contract.UnpackLog(event, "Unstaked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_StakingEventsMock *StakingEventsMockFilterer) ParseUnstaked(log types.Log) (*StakingEventsMockUnstaked, error) { - event := new(StakingEventsMockUnstaked) - if err := _StakingEventsMock.contract.UnpackLog(event, "Unstaked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -func (_StakingEventsMock *StakingEventsMock) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _StakingEventsMock.abi.Events["AlertRaised"].ID: - return _StakingEventsMock.ParseAlertRaised(log) - case _StakingEventsMock.abi.Events["FeedOperatorsSet"].ID: - return _StakingEventsMock.ParseFeedOperatorsSet(log) - case _StakingEventsMock.abi.Events["MaxCommunityStakeAmountIncreased"].ID: - return _StakingEventsMock.ParseMaxCommunityStakeAmountIncreased(log) - case _StakingEventsMock.abi.Events["MaxOperatorStakeAmountIncreased"].ID: - return _StakingEventsMock.ParseMaxOperatorStakeAmountIncreased(log) - case _StakingEventsMock.abi.Events["MerkleRootChanged"].ID: - return _StakingEventsMock.ParseMerkleRootChanged(log) - case _StakingEventsMock.abi.Events["Migrated"].ID: - return _StakingEventsMock.ParseMigrated(log) - case _StakingEventsMock.abi.Events["MigrationTargetAccepted"].ID: - return _StakingEventsMock.ParseMigrationTargetAccepted(log) - case _StakingEventsMock.abi.Events["MigrationTargetProposed"].ID: - return _StakingEventsMock.ParseMigrationTargetProposed(log) - case _StakingEventsMock.abi.Events["OperatorAdded"].ID: - return _StakingEventsMock.ParseOperatorAdded(log) - case _StakingEventsMock.abi.Events["OperatorRemoved"].ID: - return _StakingEventsMock.ParseOperatorRemoved(log) - case _StakingEventsMock.abi.Events["OwnershipTransferRequested"].ID: - return _StakingEventsMock.ParseOwnershipTransferRequested(log) - case _StakingEventsMock.abi.Events["OwnershipTransferred"].ID: - return _StakingEventsMock.ParseOwnershipTransferred(log) - case _StakingEventsMock.abi.Events["Paused"].ID: - return _StakingEventsMock.ParsePaused(log) - case _StakingEventsMock.abi.Events["PoolConcluded"].ID: - return _StakingEventsMock.ParsePoolConcluded(log) - case _StakingEventsMock.abi.Events["PoolOpened"].ID: - return _StakingEventsMock.ParsePoolOpened(log) - case _StakingEventsMock.abi.Events["PoolSizeIncreased"].ID: - return _StakingEventsMock.ParsePoolSizeIncreased(log) - case _StakingEventsMock.abi.Events["RewardAdded"].ID: - return _StakingEventsMock.ParseRewardAdded(log) - case _StakingEventsMock.abi.Events["RewardInitialized"].ID: - return _StakingEventsMock.ParseRewardInitialized(log) - case _StakingEventsMock.abi.Events["RewardRateChanged"].ID: - return _StakingEventsMock.ParseRewardRateChanged(log) - case _StakingEventsMock.abi.Events["RewardSlashed"].ID: - return _StakingEventsMock.ParseRewardSlashed(log) - case _StakingEventsMock.abi.Events["RewardWithdrawn"].ID: - return _StakingEventsMock.ParseRewardWithdrawn(log) - case _StakingEventsMock.abi.Events["Staked"].ID: - return _StakingEventsMock.ParseStaked(log) - case _StakingEventsMock.abi.Events["Unpaused"].ID: - return _StakingEventsMock.ParseUnpaused(log) - case _StakingEventsMock.abi.Events["Unstaked"].ID: - return _StakingEventsMock.ParseUnstaked(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (StakingEventsMockAlertRaised) Topic() common.Hash { - return common.HexToHash("0xd2720e8f454493f612cc97499fe8cbce7fa4d4c18d346fe7104e9042df1c1edd") -} - -func (StakingEventsMockFeedOperatorsSet) Topic() common.Hash { - return common.HexToHash("0x40aed8e423b39a56b445ae160f4c071fc2cfb48ee0b6dcd5ffeb6bc5b18d10d0") -} - -func (StakingEventsMockMaxCommunityStakeAmountIncreased) Topic() common.Hash { - return common.HexToHash("0xb5f554e5ef00806bace1edbb84186512ebcefa2af7706085143f501f29314df7") -} - -func (StakingEventsMockMaxOperatorStakeAmountIncreased) Topic() common.Hash { - return common.HexToHash("0x816587cb2e773af4f3689a03d7520fabff3462605ded374b485b13994c0d7b52") -} - -func (StakingEventsMockMerkleRootChanged) Topic() common.Hash { - return common.HexToHash("0x1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c") -} - -func (StakingEventsMockMigrated) Topic() common.Hash { - return common.HexToHash("0x667838b33bdc898470de09e0e746990f2adc11b965b7fe6828e502ebc39e0434") -} - -func (StakingEventsMockMigrationTargetAccepted) Topic() common.Hash { - return common.HexToHash("0xfa33c052bbee754f3c0482a89962daffe749191fa33c696a61e947fbfd68bd84") -} - -func (StakingEventsMockMigrationTargetProposed) Topic() common.Hash { - return common.HexToHash("0x5c74c441be501340b2713817a6c6975e6f3d4a4ae39fa1ac0bf75d3c54a0cad3") -} - -func (StakingEventsMockOperatorAdded) Topic() common.Hash { - return common.HexToHash("0xac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d") -} - -func (StakingEventsMockOperatorRemoved) Topic() common.Hash { - return common.HexToHash("0x2360404a74478febece1a14f11275f22ada88d19ef96f7d785913010bfff4479") -} - -func (StakingEventsMockOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (StakingEventsMockOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (StakingEventsMockPaused) Topic() common.Hash { - return common.HexToHash("0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258") -} - -func (StakingEventsMockPoolConcluded) Topic() common.Hash { - return common.HexToHash("0xf7d0e0f15586495da8c687328ead30fb829d9da55538cb0ef73dd229e517cdb8") -} - -func (StakingEventsMockPoolOpened) Topic() common.Hash { - return common.HexToHash("0xded6ebf04e261e1eb2f3e3b268a2e6aee5b478c15b341eba5cf18b9bc80c2e63") -} - -func (StakingEventsMockPoolSizeIncreased) Topic() common.Hash { - return common.HexToHash("0x7f4f497e086b2eb55f8a9885ba00d33399bbe0ebcb92ea092834386435a1b9c0") -} - -func (StakingEventsMockRewardAdded) Topic() common.Hash { - return common.HexToHash("0xde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d") -} - -func (StakingEventsMockRewardInitialized) Topic() common.Hash { - return common.HexToHash("0x125fc8494f786b470e3c39d0932a62e9e09e291ebd81ea19c57604f6d2b1d167") -} - -func (StakingEventsMockRewardRateChanged) Topic() common.Hash { - return common.HexToHash("0x1e3be2efa25bca5bff2215c7b30b31086e703d6aa7d9b9a1f8ba62c5291219ad") -} - -func (StakingEventsMockRewardSlashed) Topic() common.Hash { - return common.HexToHash("0x00635ea9da6e262e92bb713d71840af7c567807ff35bf73e927490c612832480") -} - -func (StakingEventsMockRewardWithdrawn) Topic() common.Hash { - return common.HexToHash("0x150a6ec0e6f4e9ddcaaaa1674f157d91165a42d60653016f87a9fc870a39f050") -} - -func (StakingEventsMockStaked) Topic() common.Hash { - return common.HexToHash("0x1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90") -} - -func (StakingEventsMockUnpaused) Topic() common.Hash { - return common.HexToHash("0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa") -} - -func (StakingEventsMockUnstaked) Topic() common.Hash { - return common.HexToHash("0x204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00") -} - -func (_StakingEventsMock *StakingEventsMock) Address() common.Address { - return _StakingEventsMock.address -} - -type StakingEventsMockInterface interface { - EmitAlertRaised(opts *bind.TransactOpts, alerter common.Address, roundId *big.Int, rewardAmount *big.Int) (*types.Transaction, error) - - EmitFeedOperatorsSet(opts *bind.TransactOpts, feedOperators []common.Address) (*types.Transaction, error) - - EmitMaxCommunityStakeAmountIncreased(opts *bind.TransactOpts, maxStakeAmount *big.Int) (*types.Transaction, error) - - EmitMaxOperatorStakeAmountIncreased(opts *bind.TransactOpts, maxStakeAmount *big.Int) (*types.Transaction, error) - - EmitMerkleRootChanged(opts *bind.TransactOpts, newMerkleRoot [32]byte) (*types.Transaction, error) - - EmitMigrated(opts *bind.TransactOpts, staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int, data []byte) (*types.Transaction, error) - - EmitMigrationTargetAccepted(opts *bind.TransactOpts, migrationTarget common.Address) (*types.Transaction, error) - - EmitMigrationTargetProposed(opts *bind.TransactOpts, migrationTarget common.Address) (*types.Transaction, error) - - EmitOperatorAdded(opts *bind.TransactOpts, operator common.Address) (*types.Transaction, error) - - EmitOperatorRemoved(opts *bind.TransactOpts, operator common.Address, amount *big.Int) (*types.Transaction, error) - - EmitOwnershipTransferRequested(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) - - EmitOwnershipTransferred(opts *bind.TransactOpts, from common.Address, to common.Address) (*types.Transaction, error) - - EmitPaused(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) - - EmitPoolConcluded(opts *bind.TransactOpts) (*types.Transaction, error) - - EmitPoolOpened(opts *bind.TransactOpts) (*types.Transaction, error) - - EmitPoolSizeIncreased(opts *bind.TransactOpts, maxPoolSize *big.Int) (*types.Transaction, error) - - EmitRewardAdded(opts *bind.TransactOpts, amountAdded *big.Int) (*types.Transaction, error) - - EmitRewardInitialized(opts *bind.TransactOpts, rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) (*types.Transaction, error) - - EmitRewardRateChanged(opts *bind.TransactOpts, rate *big.Int) (*types.Transaction, error) - - EmitRewardSlashed(opts *bind.TransactOpts, operator []common.Address, slashedBaseRewards []*big.Int, slashedDelegatedRewards []*big.Int) (*types.Transaction, error) - - EmitRewardWithdrawn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) - - EmitStaked(opts *bind.TransactOpts, staker common.Address, newStake *big.Int, totalStake *big.Int) (*types.Transaction, error) - - EmitUnpaused(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) - - EmitUnstaked(opts *bind.TransactOpts, staker common.Address, principal *big.Int, baseReward *big.Int, delegationReward *big.Int) (*types.Transaction, error) - - FilterAlertRaised(opts *bind.FilterOpts) (*StakingEventsMockAlertRaisedIterator, error) - - WatchAlertRaised(opts *bind.WatchOpts, sink chan<- *StakingEventsMockAlertRaised) (event.Subscription, error) - - ParseAlertRaised(log types.Log) (*StakingEventsMockAlertRaised, error) - - FilterFeedOperatorsSet(opts *bind.FilterOpts) (*StakingEventsMockFeedOperatorsSetIterator, error) - - WatchFeedOperatorsSet(opts *bind.WatchOpts, sink chan<- *StakingEventsMockFeedOperatorsSet) (event.Subscription, error) - - ParseFeedOperatorsSet(log types.Log) (*StakingEventsMockFeedOperatorsSet, error) - - FilterMaxCommunityStakeAmountIncreased(opts *bind.FilterOpts) (*StakingEventsMockMaxCommunityStakeAmountIncreasedIterator, error) - - WatchMaxCommunityStakeAmountIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMaxCommunityStakeAmountIncreased) (event.Subscription, error) - - ParseMaxCommunityStakeAmountIncreased(log types.Log) (*StakingEventsMockMaxCommunityStakeAmountIncreased, error) - - FilterMaxOperatorStakeAmountIncreased(opts *bind.FilterOpts) (*StakingEventsMockMaxOperatorStakeAmountIncreasedIterator, error) - - WatchMaxOperatorStakeAmountIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMaxOperatorStakeAmountIncreased) (event.Subscription, error) - - ParseMaxOperatorStakeAmountIncreased(log types.Log) (*StakingEventsMockMaxOperatorStakeAmountIncreased, error) - - FilterMerkleRootChanged(opts *bind.FilterOpts) (*StakingEventsMockMerkleRootChangedIterator, error) - - WatchMerkleRootChanged(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMerkleRootChanged) (event.Subscription, error) - - ParseMerkleRootChanged(log types.Log) (*StakingEventsMockMerkleRootChanged, error) - - FilterMigrated(opts *bind.FilterOpts) (*StakingEventsMockMigratedIterator, error) - - WatchMigrated(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrated) (event.Subscription, error) - - ParseMigrated(log types.Log) (*StakingEventsMockMigrated, error) - - FilterMigrationTargetAccepted(opts *bind.FilterOpts) (*StakingEventsMockMigrationTargetAcceptedIterator, error) - - WatchMigrationTargetAccepted(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrationTargetAccepted) (event.Subscription, error) - - ParseMigrationTargetAccepted(log types.Log) (*StakingEventsMockMigrationTargetAccepted, error) - - FilterMigrationTargetProposed(opts *bind.FilterOpts) (*StakingEventsMockMigrationTargetProposedIterator, error) - - WatchMigrationTargetProposed(opts *bind.WatchOpts, sink chan<- *StakingEventsMockMigrationTargetProposed) (event.Subscription, error) - - ParseMigrationTargetProposed(log types.Log) (*StakingEventsMockMigrationTargetProposed, error) - - FilterOperatorAdded(opts *bind.FilterOpts) (*StakingEventsMockOperatorAddedIterator, error) - - WatchOperatorAdded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOperatorAdded) (event.Subscription, error) - - ParseOperatorAdded(log types.Log) (*StakingEventsMockOperatorAdded, error) - - FilterOperatorRemoved(opts *bind.FilterOpts) (*StakingEventsMockOperatorRemovedIterator, error) - - WatchOperatorRemoved(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOperatorRemoved) (event.Subscription, error) - - ParseOperatorRemoved(log types.Log) (*StakingEventsMockOperatorRemoved, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingEventsMockOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*StakingEventsMockOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*StakingEventsMockOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *StakingEventsMockOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*StakingEventsMockOwnershipTransferred, error) - - FilterPaused(opts *bind.FilterOpts) (*StakingEventsMockPausedIterator, error) - - WatchPaused(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPaused) (event.Subscription, error) - - ParsePaused(log types.Log) (*StakingEventsMockPaused, error) - - FilterPoolConcluded(opts *bind.FilterOpts) (*StakingEventsMockPoolConcludedIterator, error) - - WatchPoolConcluded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolConcluded) (event.Subscription, error) - - ParsePoolConcluded(log types.Log) (*StakingEventsMockPoolConcluded, error) - - FilterPoolOpened(opts *bind.FilterOpts) (*StakingEventsMockPoolOpenedIterator, error) - - WatchPoolOpened(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolOpened) (event.Subscription, error) - - ParsePoolOpened(log types.Log) (*StakingEventsMockPoolOpened, error) - - FilterPoolSizeIncreased(opts *bind.FilterOpts) (*StakingEventsMockPoolSizeIncreasedIterator, error) - - WatchPoolSizeIncreased(opts *bind.WatchOpts, sink chan<- *StakingEventsMockPoolSizeIncreased) (event.Subscription, error) - - ParsePoolSizeIncreased(log types.Log) (*StakingEventsMockPoolSizeIncreased, error) - - FilterRewardAdded(opts *bind.FilterOpts) (*StakingEventsMockRewardAddedIterator, error) - - WatchRewardAdded(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardAdded) (event.Subscription, error) - - ParseRewardAdded(log types.Log) (*StakingEventsMockRewardAdded, error) - - FilterRewardInitialized(opts *bind.FilterOpts) (*StakingEventsMockRewardInitializedIterator, error) - - WatchRewardInitialized(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardInitialized) (event.Subscription, error) - - ParseRewardInitialized(log types.Log) (*StakingEventsMockRewardInitialized, error) - - FilterRewardRateChanged(opts *bind.FilterOpts) (*StakingEventsMockRewardRateChangedIterator, error) - - WatchRewardRateChanged(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardRateChanged) (event.Subscription, error) - - ParseRewardRateChanged(log types.Log) (*StakingEventsMockRewardRateChanged, error) - - FilterRewardSlashed(opts *bind.FilterOpts) (*StakingEventsMockRewardSlashedIterator, error) - - WatchRewardSlashed(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardSlashed) (event.Subscription, error) - - ParseRewardSlashed(log types.Log) (*StakingEventsMockRewardSlashed, error) - - FilterRewardWithdrawn(opts *bind.FilterOpts) (*StakingEventsMockRewardWithdrawnIterator, error) - - WatchRewardWithdrawn(opts *bind.WatchOpts, sink chan<- *StakingEventsMockRewardWithdrawn) (event.Subscription, error) - - ParseRewardWithdrawn(log types.Log) (*StakingEventsMockRewardWithdrawn, error) - - FilterStaked(opts *bind.FilterOpts) (*StakingEventsMockStakedIterator, error) - - WatchStaked(opts *bind.WatchOpts, sink chan<- *StakingEventsMockStaked) (event.Subscription, error) - - ParseStaked(log types.Log) (*StakingEventsMockStaked, error) - - FilterUnpaused(opts *bind.FilterOpts) (*StakingEventsMockUnpausedIterator, error) - - WatchUnpaused(opts *bind.WatchOpts, sink chan<- *StakingEventsMockUnpaused) (event.Subscription, error) - - ParseUnpaused(log types.Log) (*StakingEventsMockUnpaused, error) - - FilterUnstaked(opts *bind.FilterOpts) (*StakingEventsMockUnstakedIterator, error) - - WatchUnstaked(opts *bind.WatchOpts, sink chan<- *StakingEventsMockUnstaked) (event.Subscription, error) - - ParseUnstaked(log types.Log) (*StakingEventsMockUnstaked, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go deleted file mode 100644 index 0609f9e5f73..00000000000 --- a/integration-tests/contracts/ethereum_contracts.go +++ /dev/null @@ -1,1715 +0,0 @@ -package contracts - -import ( - "context" - "encoding/hex" - "errors" - "fmt" - "math/big" - "strings" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - - "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" - "github.com/smartcontractkit/libocr/gethwrappers2/ocr2aggregator" - ocrConfigHelper "github.com/smartcontractkit/libocr/offchainreporting/confighelper" - ocrTypes "github.com/smartcontractkit/libocr/offchainreporting/types" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/counter" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/mock_ethusd_aggregator_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/weth9" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/functions/generated/functions_coordinator" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/functions/generated/functions_load_test_client" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/functions/generated/functions_router" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/flux_aggregator_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/mock_ethlink_aggregator_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/mock_gas_aggregator_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/oracle_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/test_api_consumer_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/operatorforwarder/generated/operator" - contractsethereum "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - - "github.com/ethereum/go-ethereum/core/types" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_2" - iregistry22 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" - iregistry21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper2_0" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/link_token_interface" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/operatorforwarder/generated/authorized_forwarder" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/operatorforwarder/generated/operator_factory" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" -) - -// OCRv2Config represents the config for the OCRv2 contract -type OCRv2Config struct { - Signers []common.Address - Transmitters []common.Address - F uint8 - OnchainConfig []byte - TypedOnchainConfig21 i_keeper_registry_master_wrapper_2_1.IAutomationV21PlusCommonOnchainConfigLegacy - TypedOnchainConfig22 i_automation_registry_master_wrapper_2_2.AutomationRegistryBase22OnchainConfig - TypedOnchainConfig23 i_automation_registry_master_wrapper_2_3.AutomationRegistryBase23OnchainConfig - OffchainConfigVersion uint64 - OffchainConfig []byte - BillingTokens []common.Address - BillingConfigs []i_automation_registry_master_wrapper_2_3.AutomationRegistryBase23BillingConfig -} - -type EthereumFunctionsLoadStats struct { - LastRequestID string - LastResponse string - LastError string - Total uint32 - Succeeded uint32 - Errored uint32 - Empty uint32 -} - -func Bytes32ToSlice(a [32]byte) (r []byte) { - r = append(r, a[:]...) - return -} - -// DefaultOffChainAggregatorOptions returns some base defaults for deploying an OCR contract -func DefaultOffChainAggregatorOptions() OffchainOptions { - return OffchainOptions{ - MaximumGasPrice: uint32(3000), - ReasonableGasPrice: uint32(10), - MicroLinkPerEth: uint32(500), - LinkGweiPerObservation: uint32(500), - LinkGweiPerTransmission: uint32(500), - MinimumAnswer: big.NewInt(1), - MaximumAnswer: big.NewInt(50000000000000000), - Decimals: 8, - Description: "Test OCR", - } -} - -// DefaultOffChainAggregatorConfig returns some base defaults for configuring an OCR contract -func DefaultOffChainAggregatorConfig(numberNodes int) OffChainAggregatorConfig { - s := []int{1} - // First node's stage already inputted as a 1 in line above, so numberNodes-1. - for i := 0; i < numberNodes-1; i++ { - s = append(s, 2) - } - return OffChainAggregatorConfig{ - AlphaPPB: 1, - DeltaC: time.Minute * 60, - DeltaGrace: time.Second * 12, - DeltaProgress: time.Second * 35, - DeltaStage: time.Second * 60, - DeltaResend: time.Second * 17, - DeltaRound: time.Second * 30, - RMax: 6, - S: s, - N: numberNodes, - F: 1, - OracleIdentities: []ocrConfigHelper.OracleIdentityExtra{}, - } -} - -func ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(k8sNodes []*nodeclient.ChainlinkK8sClient) []ChainlinkNodeWithKeysAndAddress { - var nodesAsInterface = make([]ChainlinkNodeWithKeysAndAddress, len(k8sNodes)) - for i, node := range k8sNodes { - nodesAsInterface[i] = node - } - - return nodesAsInterface -} - -func ChainlinkClientToChainlinkNodeWithKeysAndAddress(k8sNodes []*nodeclient.ChainlinkClient) []ChainlinkNodeWithKeysAndAddress { - var nodesAsInterface = make([]ChainlinkNodeWithKeysAndAddress, len(k8sNodes)) - for i, node := range k8sNodes { - nodesAsInterface[i] = node - } - - return nodesAsInterface -} - -func V2OffChainAgrregatorToOffChainAggregatorWithRounds(contracts []OffchainAggregatorV2) []OffChainAggregatorWithRounds { - var contractsAsInterface = make([]OffChainAggregatorWithRounds, len(contracts)) - for i, contract := range contracts { - contractsAsInterface[i] = contract - } - - return contractsAsInterface -} - -func V1OffChainAgrregatorToOffChainAggregatorWithRounds(contracts []OffchainAggregator) []OffChainAggregatorWithRounds { - var contractsAsInterface = make([]OffChainAggregatorWithRounds, len(contracts)) - for i, contract := range contracts { - contractsAsInterface[i] = contract - } - - return contractsAsInterface -} - -func GetRegistryContractABI(version contractsethereum.KeeperRegistryVersion) (*abi.ABI, error) { - var ( - contractABI *abi.ABI - err error - ) - switch version { - case contractsethereum.RegistryVersion_1_0, contractsethereum.RegistryVersion_1_1: - contractABI, err = keeper_registry_wrapper1_1.KeeperRegistryMetaData.GetAbi() - case contractsethereum.RegistryVersion_1_2: - contractABI, err = keeper_registry_wrapper1_2.KeeperRegistryMetaData.GetAbi() - case contractsethereum.RegistryVersion_1_3: - contractABI, err = keeper_registry_wrapper1_3.KeeperRegistryMetaData.GetAbi() - case contractsethereum.RegistryVersion_2_0: - contractABI, err = keeper_registry_wrapper2_0.KeeperRegistryMetaData.GetAbi() - case contractsethereum.RegistryVersion_2_1: - contractABI, err = iregistry21.IKeeperRegistryMasterMetaData.GetAbi() - case contractsethereum.RegistryVersion_2_2: - contractABI, err = iregistry22.IAutomationRegistryMasterMetaData.GetAbi() - default: - contractABI, err = keeper_registry_wrapper2_0.KeeperRegistryMetaData.GetAbi() - } - - return contractABI, err -} - -// DefaultFluxAggregatorOptions produces some basic defaults for a flux aggregator contract -func DefaultFluxAggregatorOptions() FluxAggregatorOptions { - return FluxAggregatorOptions{ - PaymentAmount: big.NewInt(1), - Timeout: uint32(30), - MinSubValue: big.NewInt(0), - MaxSubValue: big.NewInt(1000000000000), - Decimals: uint8(0), - Description: "Test Flux Aggregator", - } -} - -// EthereumOffchainAggregator represents the offchain aggregation contract -type EthereumOffchainAggregator struct { - client *seth.Client - ocr *offchainaggregator.OffchainAggregator - address *common.Address - l zerolog.Logger -} - -func LoadOffChainAggregator(l zerolog.Logger, sethClient *seth.Client, contractAddress common.Address) (EthereumOffchainAggregator, error) { - loader := seth.NewContractLoader[offchainaggregator.OffchainAggregator](sethClient) - instance, err := loader.LoadContract("LinkToken", contractAddress, offchainaggregator.OffchainAggregatorMetaData.GetAbi, offchainaggregator.NewOffchainAggregator) - - if err != nil { - return EthereumOffchainAggregator{}, fmt.Errorf("failed to instantiate OCR v2 instance: %w", err) - } - - return EthereumOffchainAggregator{ - client: sethClient, - ocr: instance, - address: &contractAddress, - l: l, - }, nil -} - -func DeployOffchainAggregator(l zerolog.Logger, seth *seth.Client, linkTokenAddress common.Address, offchainOptions OffchainOptions) (EthereumOffchainAggregator, error) { - abi, err := offchainaggregator.OffchainAggregatorMetaData.GetAbi() - if err != nil { - return EthereumOffchainAggregator{}, fmt.Errorf("failed to get OffChain Aggregator ABI: %w", err) - } - - ocrDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "OffChainAggregator", - *abi, - common.FromHex(offchainaggregator.OffchainAggregatorMetaData.Bin), - offchainOptions.MaximumGasPrice, - offchainOptions.ReasonableGasPrice, - offchainOptions.MicroLinkPerEth, - offchainOptions.LinkGweiPerObservation, - offchainOptions.LinkGweiPerTransmission, - linkTokenAddress, - offchainOptions.MinimumAnswer, - offchainOptions.MaximumAnswer, - offchainOptions.BillingAccessController, - offchainOptions.RequesterAccessController, - offchainOptions.Decimals, - offchainOptions.Description) - if err != nil { - return EthereumOffchainAggregator{}, fmt.Errorf("OCR instance deployment have failed: %w", err) - } - - ocr, err := offchainaggregator.NewOffchainAggregator(ocrDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return EthereumOffchainAggregator{}, fmt.Errorf("failed to instantiate OCR instance: %w", err) - } - - return EthereumOffchainAggregator{ - client: seth, - ocr: ocr, - address: &ocrDeploymentData.Address, - l: l, - }, nil -} - -// SetPayees sets wallets for the contract to pay out to? -func (o *EthereumOffchainAggregator) SetPayees( - transmitters, payees []string, -) error { - var transmittersAddr, payeesAddr []common.Address - for _, tr := range transmitters { - transmittersAddr = append(transmittersAddr, common.HexToAddress(tr)) - } - for _, p := range payees { - payeesAddr = append(payeesAddr, common.HexToAddress(p)) - } - - o.l.Info(). - Str("Transmitters", fmt.Sprintf("%v", transmitters)). - Str("Payees", fmt.Sprintf("%v", payees)). - Str("OCR Address", o.Address()). - Msg("Setting OCR Payees") - - _, err := o.client.Decode(o.ocr.SetPayees(o.client.NewTXOpts(), transmittersAddr, payeesAddr)) - return err -} - -// SetConfig sets the payees and the offchain reporting protocol configuration -func (o *EthereumOffchainAggregator) SetConfig( - chainlinkNodes []ChainlinkNodeWithKeysAndAddress, - ocrConfig OffChainAggregatorConfig, - transmitters []common.Address, -) error { - // Gather necessary addresses and keys from our chainlink nodes to properly configure the OCR contract - log.Info().Str("Contract Address", o.address.Hex()).Msg("Configuring OCR Contract") - for i, node := range chainlinkNodes { - ocrKeys, err := node.MustReadOCRKeys() - if err != nil { - return err - } - if len(ocrKeys.Data) == 0 { - return fmt.Errorf("no OCR keys found for node %v", node) - } - primaryOCRKey := ocrKeys.Data[0] - p2pKeys, err := node.MustReadP2PKeys() - if err != nil { - return err - } - primaryP2PKey := p2pKeys.Data[0] - - // Need to convert the key representations - var onChainSigningAddress [20]byte - var configPublicKey [32]byte - offchainSigningAddress, err := hex.DecodeString(primaryOCRKey.Attributes.OffChainPublicKey) - if err != nil { - return err - } - decodeConfigKey, err := hex.DecodeString(primaryOCRKey.Attributes.ConfigPublicKey) - if err != nil { - return err - } - - // https://stackoverflow.com/questions/8032170/how-to-assign-string-to-bytes-array - copy(onChainSigningAddress[:], common.HexToAddress(primaryOCRKey.Attributes.OnChainSigningAddress).Bytes()) - copy(configPublicKey[:], decodeConfigKey) - - oracleIdentity := ocrConfigHelper.OracleIdentity{ - TransmitAddress: transmitters[i], - OnChainSigningAddress: onChainSigningAddress, - PeerID: primaryP2PKey.Attributes.PeerID, - OffchainPublicKey: offchainSigningAddress, - } - oracleIdentityExtra := ocrConfigHelper.OracleIdentityExtra{ - OracleIdentity: oracleIdentity, - SharedSecretEncryptionPublicKey: ocrTypes.SharedSecretEncryptionPublicKey(configPublicKey), - } - - ocrConfig.OracleIdentities = append(ocrConfig.OracleIdentities, oracleIdentityExtra) - } - - signers, transmitters, threshold, encodedConfigVersion, encodedConfig, err := ocrConfigHelper.ContractSetConfigArgs( - ocrConfig.DeltaProgress, - ocrConfig.DeltaResend, - ocrConfig.DeltaRound, - ocrConfig.DeltaGrace, - ocrConfig.DeltaC, - ocrConfig.AlphaPPB, - ocrConfig.DeltaStage, - ocrConfig.RMax, - ocrConfig.S, - ocrConfig.OracleIdentities, - ocrConfig.F, - ) - if err != nil { - return err - } - - _, err = o.client.Decode(o.ocr.SetConfig(o.client.NewTXOpts(), signers, transmitters, threshold, encodedConfigVersion, encodedConfig)) - return err -} - -// RequestNewRound requests the OCR contract to create a new round -func (o *EthereumOffchainAggregator) RequestNewRound() error { - o.l.Info().Str("Contract Address", o.address.Hex()).Msg("New OCR round requested") - _, err := o.client.Decode(o.ocr.RequestNewRound(o.client.NewTXOpts())) - return err -} - -// GetLatestAnswer returns the latest answer from the OCR contract -func (o *EthereumOffchainAggregator) GetLatestAnswer(ctx context.Context) (*big.Int, error) { - return o.ocr.LatestAnswer(&bind.CallOpts{ - From: o.client.Addresses[0], - Context: ctx, - }) -} - -func (o *EthereumOffchainAggregator) Address() string { - return o.address.Hex() -} - -// GetLatestRound returns data from the latest round -func (o *EthereumOffchainAggregator) GetLatestRound(ctx context.Context) (*RoundData, error) { - roundData, err := o.ocr.LatestRoundData(&bind.CallOpts{ - From: o.client.Addresses[0], - Context: ctx, - }) - if err != nil { - return nil, err - } - - return &RoundData{ - RoundId: roundData.RoundId, - Answer: roundData.Answer, - AnsweredInRound: roundData.AnsweredInRound, - StartedAt: roundData.StartedAt, - UpdatedAt: roundData.UpdatedAt, - }, err -} - -func (o *EthereumOffchainAggregator) LatestRoundDataUpdatedAt() (*big.Int, error) { - data, err := o.ocr.LatestRoundData(o.client.NewCallOpts()) - if err != nil { - return nil, err - } - return data.UpdatedAt, nil -} - -// GetRound retrieves an OCR round by the round ID -func (o *EthereumOffchainAggregator) GetRound(ctx context.Context, roundID *big.Int) (*RoundData, error) { - roundData, err := o.ocr.GetRoundData(&bind.CallOpts{ - From: o.client.Addresses[0], - Context: ctx, - }, roundID) - if err != nil { - return nil, err - } - - return &RoundData{ - RoundId: roundData.RoundId, - Answer: roundData.Answer, - AnsweredInRound: roundData.AnsweredInRound, - StartedAt: roundData.StartedAt, - UpdatedAt: roundData.UpdatedAt, - }, nil -} - -// ParseEventAnswerUpdated parses the log for event AnswerUpdated -func (o *EthereumOffchainAggregator) ParseEventAnswerUpdated(eventLog types.Log) (*offchainaggregator.OffchainAggregatorAnswerUpdated, error) { - return o.ocr.ParseAnswerUpdated(eventLog) -} - -// LegacyEthereumOperatorFactory represents operator factory contract -type EthereumOperatorFactory struct { - address *common.Address - client *seth.Client - operatorFactory *operator_factory.OperatorFactory -} - -func DeployEthereumOperatorFactory(seth *seth.Client, linkTokenAddress common.Address) (EthereumOperatorFactory, error) { - abi, err := operator_factory.OperatorFactoryMetaData.GetAbi() - if err != nil { - return EthereumOperatorFactory{}, fmt.Errorf("failed to get OperatorFactory ABI: %w", err) - } - operatorData, err := seth.DeployContract(seth.NewTXOpts(), "OperatorFactory", *abi, common.FromHex(operator_factory.OperatorFactoryMetaData.Bin), linkTokenAddress) - if err != nil { - return EthereumOperatorFactory{}, fmt.Errorf("OperatorFactory instance deployment have failed: %w", err) - } - - operatorFactory, err := operator_factory.NewOperatorFactory(operatorData.Address, seth.Client) - if err != nil { - return EthereumOperatorFactory{}, fmt.Errorf("failed to instantiate OperatorFactory instance: %w", err) - } - - return EthereumOperatorFactory{ - address: &operatorData.Address, - client: seth, - operatorFactory: operatorFactory, - }, nil -} - -func (e *EthereumOperatorFactory) ParseAuthorizedForwarderCreated(eventLog types.Log) (*operator_factory.OperatorFactoryAuthorizedForwarderCreated, error) { - return e.operatorFactory.ParseAuthorizedForwarderCreated(eventLog) -} - -func (e *EthereumOperatorFactory) ParseOperatorCreated(eventLog types.Log) (*operator_factory.OperatorFactoryOperatorCreated, error) { - return e.operatorFactory.ParseOperatorCreated(eventLog) -} - -func (e *EthereumOperatorFactory) Address() string { - return e.address.Hex() -} - -func (e *EthereumOperatorFactory) DeployNewOperatorAndForwarder() (*types.Transaction, error) { - return e.operatorFactory.DeployNewOperatorAndForwarder(e.client.NewTXOpts()) -} - -// EthereumOperator represents operator contract -type EthereumOperator struct { - address *common.Address - client *seth.Client - operator *operator.Operator - l zerolog.Logger -} - -func LoadEthereumOperator(logger zerolog.Logger, seth *seth.Client, contractAddress common.Address) (EthereumOperator, error) { - abi, err := operator.OperatorMetaData.GetAbi() - if err != nil { - return EthereumOperator{}, err - } - seth.ContractStore.AddABI("EthereumOperator", *abi) - seth.ContractStore.AddBIN("EthereumOperator", common.FromHex(operator.OperatorMetaData.Bin)) - - operator, err := operator.NewOperator(contractAddress, seth.Client) - if err != nil { - return EthereumOperator{}, err - } - - return EthereumOperator{ - address: &contractAddress, - client: seth, - operator: operator, - l: logger, - }, nil -} - -func (e *EthereumOperator) Address() string { - return e.address.Hex() -} - -func (e *EthereumOperator) AcceptAuthorizedReceivers(forwarders []common.Address, eoa []common.Address) error { - e.l.Info(). - Str("ForwardersAddresses", fmt.Sprint(forwarders)). - Str("EoaAddresses", fmt.Sprint(eoa)). - Msg("Accepting Authorized Receivers") - _, err := e.client.Decode(e.operator.AcceptAuthorizedReceivers(e.client.NewTXOpts(), forwarders, eoa)) - return err -} - -// EthereumAuthorizedForwarder represents authorized forwarder contract -type EthereumAuthorizedForwarder struct { - address *common.Address - client *seth.Client - authorizedForwarder *authorized_forwarder.AuthorizedForwarder -} - -func LoadEthereumAuthorizedForwarder(seth *seth.Client, contractAddress common.Address) (EthereumAuthorizedForwarder, error) { - abi, err := authorized_forwarder.AuthorizedForwarderMetaData.GetAbi() - if err != nil { - return EthereumAuthorizedForwarder{}, err - } - seth.ContractStore.AddABI("AuthorizedForwarder", *abi) - seth.ContractStore.AddBIN("AuthorizedForwarder", common.FromHex(authorized_forwarder.AuthorizedForwarderMetaData.Bin)) - - authorizedForwarder, err := authorized_forwarder.NewAuthorizedForwarder(contractAddress, seth.Client) - if err != nil { - return EthereumAuthorizedForwarder{}, fmt.Errorf("failed to instantiate AuthorizedForwarder instance: %w", err) - } - - return EthereumAuthorizedForwarder{ - address: &contractAddress, - client: seth, - authorizedForwarder: authorizedForwarder, - }, nil -} - -// Owner return authorized forwarder owner address -func (e *EthereumAuthorizedForwarder) Owner(_ context.Context) (string, error) { - owner, err := e.authorizedForwarder.Owner(e.client.NewCallOpts()) - - return owner.Hex(), err -} - -func (e *EthereumAuthorizedForwarder) GetAuthorizedSenders(ctx context.Context) ([]string, error) { - opts := &bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - } - authorizedSenders, err := e.authorizedForwarder.GetAuthorizedSenders(opts) - if err != nil { - return nil, err - } - var sendersAddrs []string - for _, o := range authorizedSenders { - sendersAddrs = append(sendersAddrs, o.Hex()) - } - return sendersAddrs, nil -} - -func (e *EthereumAuthorizedForwarder) Address() string { - return e.address.Hex() -} - -type EthereumOffchainAggregatorV2 struct { - address *common.Address - client *seth.Client - contract *ocr2aggregator.OCR2Aggregator - l zerolog.Logger -} - -func LoadOffchainAggregatorV2(l zerolog.Logger, seth *seth.Client, address common.Address) (EthereumOffchainAggregatorV2, error) { - contractAbi, err := ocr2aggregator.OCR2AggregatorMetaData.GetAbi() - if err != nil { - return EthereumOffchainAggregatorV2{}, fmt.Errorf("failed to get OffChain Aggregator v2 ABI: %w", err) - } - seth.ContractStore.AddABI("OffChainAggregatorV2", *contractAbi) - seth.ContractStore.AddBIN("OffChainAggregatorV2", common.FromHex(ocr2aggregator.OCR2AggregatorMetaData.Bin)) - - ocr2, err := ocr2aggregator.NewOCR2Aggregator(address, seth.Client) - if err != nil { - return EthereumOffchainAggregatorV2{}, fmt.Errorf("failed to instantiate OCRv2 instance: %w", err) - } - - return EthereumOffchainAggregatorV2{ - client: seth, - contract: ocr2, - address: &address, - l: l, - }, nil -} - -func DeployOffchainAggregatorV2(l zerolog.Logger, seth *seth.Client, linkTokenAddress common.Address, offchainOptions OffchainOptions) (EthereumOffchainAggregatorV2, error) { - contractAbi, err := ocr2aggregator.OCR2AggregatorMetaData.GetAbi() - if err != nil { - return EthereumOffchainAggregatorV2{}, fmt.Errorf("failed to get OffChain Aggregator v2 ABI: %w", err) - } - seth.ContractStore.AddABI("OffChainAggregatorV2", *contractAbi) - seth.ContractStore.AddBIN("OffChainAggregatorV2", common.FromHex(ocr2aggregator.OCR2AggregatorMetaData.Bin)) - - ocrDeploymentData2, err := seth.DeployContract(seth.NewTXOpts(), "OffChainAggregatorV2", *contractAbi, common.FromHex(ocr2aggregator.OCR2AggregatorMetaData.Bin), - linkTokenAddress, - offchainOptions.MinimumAnswer, - offchainOptions.MaximumAnswer, - offchainOptions.BillingAccessController, - offchainOptions.RequesterAccessController, - offchainOptions.Decimals, - offchainOptions.Description, - ) - - if err != nil { - return EthereumOffchainAggregatorV2{}, fmt.Errorf("OCRv2 instance deployment have failed: %w", err) - } - - ocr2, err := ocr2aggregator.NewOCR2Aggregator(ocrDeploymentData2.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return EthereumOffchainAggregatorV2{}, fmt.Errorf("failed to instantiate OCRv2 instance: %w", err) - } - - return EthereumOffchainAggregatorV2{ - client: seth, - contract: ocr2, - address: &ocrDeploymentData2.Address, - l: l, - }, nil -} - -func (e *EthereumOffchainAggregatorV2) Address() string { - return e.address.Hex() -} - -func (e *EthereumOffchainAggregatorV2) RequestNewRound() error { - _, err := e.client.Decode(e.contract.RequestNewRound(e.client.NewTXOpts())) - return err -} - -func (e *EthereumOffchainAggregatorV2) GetLatestAnswer(ctx context.Context) (*big.Int, error) { - return e.contract.LatestAnswer(&bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - }) -} - -func (e *EthereumOffchainAggregatorV2) GetLatestRound(ctx context.Context) (*RoundData, error) { - data, err := e.contract.LatestRoundData(&bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - }) - if err != nil { - return nil, err - } - return &RoundData{ - RoundId: data.RoundId, - StartedAt: data.StartedAt, - UpdatedAt: data.UpdatedAt, - AnsweredInRound: data.AnsweredInRound, - Answer: data.Answer, - }, nil -} - -func (e *EthereumOffchainAggregatorV2) GetRound(ctx context.Context, roundID *big.Int) (*RoundData, error) { - data, err := e.contract.GetRoundData(&bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - }, roundID) - if err != nil { - return nil, err - } - return &RoundData{ - RoundId: data.RoundId, - StartedAt: data.StartedAt, - UpdatedAt: data.UpdatedAt, - AnsweredInRound: data.AnsweredInRound, - Answer: data.Answer, - }, nil -} - -func (e *EthereumOffchainAggregatorV2) SetPayees(transmitters, payees []string) error { - e.l.Info(). - Str("Transmitters", fmt.Sprintf("%v", transmitters)). - Str("Payees", fmt.Sprintf("%v", payees)). - Str("OCRv2 Address", e.Address()). - Msg("Setting OCRv2 Payees") - - var addTransmitters, addrPayees []common.Address - for _, t := range transmitters { - addTransmitters = append(addTransmitters, common.HexToAddress(t)) - } - for _, p := range payees { - addrPayees = append(addrPayees, common.HexToAddress(p)) - } - - _, err := e.client.Decode(e.contract.SetPayees(e.client.NewTXOpts(), addTransmitters, addrPayees)) - return err -} - -func (e *EthereumOffchainAggregatorV2) SetConfig(ocrConfig *OCRv2Config) error { - e.l.Info(). - Str("Address", e.Address()). - Interface("Signers", ocrConfig.Signers). - Interface("Transmitters", ocrConfig.Transmitters). - Uint8("F", ocrConfig.F). - Str("OnchainConfig", string(ocrConfig.OnchainConfig)). - Uint64("OffchainConfigVersion", ocrConfig.OffchainConfigVersion). - Str("OffchainConfig", string(ocrConfig.OffchainConfig)). - Msg("Setting OCRv2 Config") - - _, err := e.client.Decode(e.contract.SetConfig( - e.client.NewTXOpts(), - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.OnchainConfig, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - )) - return err -} - -func (e *EthereumOffchainAggregatorV2) ParseEventAnswerUpdated(log types.Log) (*ocr2aggregator.OCR2AggregatorAnswerUpdated, error) { - return e.contract.ParseAnswerUpdated(log) -} - -// EthereumLinkToken represents a LinkToken address -type EthereumLinkToken struct { - client *seth.Client - instance *link_token_interface.LinkToken - address common.Address - l zerolog.Logger -} - -func (l *EthereumLinkToken) Decimals() uint { - return 18 -} - -func DeployLinkTokenContract(l zerolog.Logger, client *seth.Client) (*EthereumLinkToken, error) { - linkTokenAbi, err := link_token_interface.LinkTokenMetaData.GetAbi() - if err != nil { - return &EthereumLinkToken{}, fmt.Errorf("failed to get LinkToken ABI: %w", err) - } - linkDeploymentData, err := client.DeployContract(client.NewTXOpts(), "LinkToken", *linkTokenAbi, common.FromHex(link_token_interface.LinkTokenMetaData.Bin)) - if err != nil { - return &EthereumLinkToken{}, fmt.Errorf("LinkToken instance deployment have failed: %w", err) - } - - linkToken, err := link_token_interface.NewLinkToken(linkDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumLinkToken{}, fmt.Errorf("failed to instantiate LinkToken instance: %w", err) - } - - return &EthereumLinkToken{ - client: client, - instance: linkToken, - address: linkDeploymentData.Address, - l: l, - }, nil -} - -func LoadLinkTokenContract(l zerolog.Logger, client *seth.Client, address common.Address) (*EthereumLinkToken, error) { - loader := seth.NewContractLoader[link_token_interface.LinkToken](client) - instance, err := loader.LoadContract("LinkToken", address, link_token_interface.LinkTokenMetaData.GetAbi, link_token_interface.NewLinkToken) - - if err != nil { - return &EthereumLinkToken{}, fmt.Errorf("failed to instantiate LinkToken instance: %w", err) - } - - return &EthereumLinkToken{ - client: client, - instance: instance, - address: address, - l: l, - }, nil -} - -// Fund the LINK Token contract with ETH to distribute the token -func (l *EthereumLinkToken) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} - -func (l *EthereumLinkToken) BalanceOf(ctx context.Context, addr string) (*big.Int, error) { - return l.instance.BalanceOf(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: ctx, - }, common.HexToAddress(addr)) -} - -// Name returns the name of the link token -func (l *EthereumLinkToken) Name(ctx context.Context) (string, error) { - return l.instance.Name(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: ctx, - }) -} - -func (l *EthereumLinkToken) Address() string { - return l.address.Hex() -} - -func (l *EthereumLinkToken) Approve(to string, amount *big.Int) error { - l.l.Info(). - Str("From", l.client.Addresses[0].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Approving LINK Transfer") - _, err := l.client.Decode(l.instance.Approve(l.client.NewTXOpts(), common.HexToAddress(to), amount)) - return err -} - -func (l *EthereumLinkToken) Transfer(to string, amount *big.Int) error { - l.l.Info(). - Str("From", l.client.Addresses[0].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Transferring LINK") - _, err := l.client.Decode(l.instance.Transfer(l.client.NewTXOpts(), common.HexToAddress(to), amount)) - return err -} - -func (l *EthereumLinkToken) TransferAndCall(to string, amount *big.Int, data []byte) (*types.Transaction, error) { - l.l.Info(). - Str("From", l.client.Addresses[0].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Transferring and Calling LINK") - decodedTx, err := l.client.Decode(l.instance.TransferAndCall(l.client.NewTXOpts(), common.HexToAddress(to), amount, data)) - if err != nil { - return nil, err - } - return decodedTx.Transaction, nil -} - -func (l *EthereumLinkToken) TransferAndCallFromKey(to string, amount *big.Int, data []byte, keyNum int) (*types.Transaction, error) { - l.l.Info(). - Str("From", l.client.Addresses[keyNum].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Transferring and Calling LINK") - decodedTx, err := l.client.Decode(l.instance.TransferAndCall(l.client.NewTXKeyOpts(keyNum), common.HexToAddress(to), amount, data)) - if err != nil { - return nil, err - } - return decodedTx.Transaction, nil -} - -// DeployFluxAggregatorContract deploys the Flux Aggregator Contract on an EVM chain -func DeployFluxAggregatorContract( - seth *seth.Client, - linkAddr string, - fluxOptions FluxAggregatorOptions, -) (FluxAggregator, error) { - abi, err := flux_aggregator_wrapper.FluxAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumFluxAggregator{}, fmt.Errorf("failed to get FluxAggregator ABI: %w", err) - } - seth.ContractStore.AddABI("FluxAggregator", *abi) - seth.ContractStore.AddBIN("FluxAggregator", common.FromHex(flux_aggregator_wrapper.FluxAggregatorMetaData.Bin)) - - fluxDeploymentData, err := seth.DeployContract(seth.NewTXOpts(), "FluxAggregator", *abi, common.FromHex(flux_aggregator_wrapper.FluxAggregatorMetaData.Bin), - common.HexToAddress(linkAddr), - fluxOptions.PaymentAmount, - fluxOptions.Timeout, - fluxOptions.Validator, - fluxOptions.MinSubValue, - fluxOptions.MaxSubValue, - fluxOptions.Decimals, - fluxOptions.Description, - ) - - if err != nil { - return &EthereumFluxAggregator{}, fmt.Errorf("FluxAggregator instance deployment have failed: %w", err) - } - - flux, err := flux_aggregator_wrapper.NewFluxAggregator(fluxDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumFluxAggregator{}, fmt.Errorf("failed to instantiate FluxAggregator instance: %w", err) - } - - return &EthereumFluxAggregator{ - client: seth, - address: &fluxDeploymentData.Address, - fluxAggregator: flux, - }, nil -} - -// EthereumFluxAggregator represents the basic flux aggregation contract -type EthereumFluxAggregator struct { - client *seth.Client - fluxAggregator *flux_aggregator_wrapper.FluxAggregator - address *common.Address -} - -func (f *EthereumFluxAggregator) Address() string { - return f.address.Hex() -} - -// Fund sends specified currencies to the contract -func (f *EthereumFluxAggregator) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -func (f *EthereumFluxAggregator) UpdateAvailableFunds() error { - _, err := f.client.Decode(f.fluxAggregator.UpdateAvailableFunds(f.client.NewTXOpts())) - return err -} - -func (f *EthereumFluxAggregator) PaymentAmount(ctx context.Context) (*big.Int, error) { - return f.fluxAggregator.PaymentAmount(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - }) -} - -func (f *EthereumFluxAggregator) RequestNewRound(context.Context) error { - _, err := f.client.Decode(f.fluxAggregator.RequestNewRound(f.client.NewTXOpts())) - return err -} - -// WatchSubmissionReceived subscribes to any submissions on a flux feed -func (f *EthereumFluxAggregator) WatchSubmissionReceived(_ context.Context, _ chan<- *SubmissionEvent) error { - panic("do not use this method, instead use XXXX") -} - -func (f *EthereumFluxAggregator) SetRequesterPermissions(_ context.Context, addr common.Address, authorized bool, roundsDelay uint32) error { - _, err := f.client.Decode(f.fluxAggregator.SetRequesterPermissions(f.client.NewTXOpts(), addr, authorized, roundsDelay)) - return err -} - -func (f *EthereumFluxAggregator) GetOracles(ctx context.Context) ([]string, error) { - addresses, err := f.fluxAggregator.GetOracles(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - }) - if err != nil { - return nil, err - } - var oracleAddrs []string - for _, o := range addresses { - oracleAddrs = append(oracleAddrs, o.Hex()) - } - return oracleAddrs, nil -} - -func (f *EthereumFluxAggregator) LatestRoundID(ctx context.Context) (*big.Int, error) { - return f.fluxAggregator.LatestRound(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - }) -} - -func (f *EthereumFluxAggregator) WithdrawPayment( - _ context.Context, - from common.Address, - to common.Address, - amount *big.Int) error { - _, err := f.client.Decode(f.fluxAggregator.WithdrawPayment(f.client.NewTXOpts(), from, to, amount)) - return err -} - -func (f *EthereumFluxAggregator) WithdrawablePayment(ctx context.Context, addr common.Address) (*big.Int, error) { - return f.fluxAggregator.WithdrawablePayment(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - }, addr) -} - -func (f *EthereumFluxAggregator) LatestRoundData(ctx context.Context) (flux_aggregator_wrapper.LatestRoundData, error) { - return f.fluxAggregator.LatestRoundData(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - }) -} - -// GetContractData retrieves basic data for the flux aggregator contract -func (f *EthereumFluxAggregator) GetContractData(ctx context.Context) (*FluxAggregatorData, error) { - opts := &bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctx, - } - - allocated, err := f.fluxAggregator.AllocatedFunds(opts) - if err != nil { - return &FluxAggregatorData{}, err - } - - available, err := f.fluxAggregator.AvailableFunds(opts) - if err != nil { - return &FluxAggregatorData{}, err - } - - lr, err := f.fluxAggregator.LatestRoundData(opts) - if err != nil { - return &FluxAggregatorData{}, err - } - latestRound := RoundData(lr) - - oracles, err := f.fluxAggregator.GetOracles(opts) - if err != nil { - return &FluxAggregatorData{}, err - } - - return &FluxAggregatorData{ - AllocatedFunds: allocated, - AvailableFunds: available, - LatestRoundData: latestRound, - Oracles: oracles, - }, nil -} - -// SetOracles allows the ability to add and/or remove oracles from the contract, and to set admins -func (f *EthereumFluxAggregator) SetOracles(o FluxAggregatorSetOraclesOptions) error { - _, err := f.client.Decode(f.fluxAggregator.ChangeOracles(f.client.NewTXOpts(), o.RemoveList, o.AddList, o.AdminList, o.MinSubmissions, o.MaxSubmissions, o.RestartDelayRounds)) - if err != nil { - return err - } - return err -} - -// Description returns the description of the flux aggregator contract -func (f *EthereumFluxAggregator) Description(ctxt context.Context) (string, error) { - return f.fluxAggregator.Description(&bind.CallOpts{ - From: f.client.Addresses[0], - Context: ctxt, - }) -} - -func DeployOracle(seth *seth.Client, linkAddr string) (Oracle, error) { - abi, err := oracle_wrapper.OracleMetaData.GetAbi() - if err != nil { - return &EthereumOracle{}, fmt.Errorf("failed to get Oracle ABI: %w", err) - } - seth.ContractStore.AddABI("Oracle", *abi) - seth.ContractStore.AddBIN("Oracle", common.FromHex(oracle_wrapper.OracleMetaData.Bin)) - - oracleDeploymentData, err := seth.DeployContract(seth.NewTXOpts(), "Oracle", *abi, common.FromHex(oracle_wrapper.OracleMetaData.Bin), - common.HexToAddress(linkAddr), - ) - - if err != nil { - return &EthereumOracle{}, fmt.Errorf("Oracle instance deployment have failed: %w", err) - } - - oracle, err := oracle_wrapper.NewOracle(oracleDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumOracle{}, fmt.Errorf("Oracle to instantiate FluxAggregator instance: %w", err) - } - - return &EthereumOracle{ - client: seth, - address: &oracleDeploymentData.Address, - oracle: oracle, - }, nil -} - -// EthereumOracle oracle for "directrequest" job tests -type EthereumOracle struct { - address *common.Address - client *seth.Client - oracle *oracle_wrapper.Oracle -} - -func (e *EthereumOracle) Address() string { - return e.address.Hex() -} - -func (e *EthereumOracle) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -// SetFulfillmentPermission sets fulfillment permission for particular address -func (e *EthereumOracle) SetFulfillmentPermission(address string, allowed bool) error { - _, err := e.client.Decode(e.oracle.SetFulfillmentPermission(e.client.NewTXOpts(), common.HexToAddress(address), allowed)) - return err -} - -func DeployAPIConsumer(seth *seth.Client, linkAddr string) (APIConsumer, error) { - abi, err := test_api_consumer_wrapper.TestAPIConsumerMetaData.GetAbi() - if err != nil { - return &EthereumAPIConsumer{}, fmt.Errorf("failed to get TestAPIConsumer ABI: %w", err) - } - seth.ContractStore.AddABI("TestAPIConsumer", *abi) - seth.ContractStore.AddBIN("TestAPIConsumer", common.FromHex(test_api_consumer_wrapper.TestAPIConsumerMetaData.Bin)) - - consumerDeploymentData, err := seth.DeployContract(seth.NewTXOpts(), "TestAPIConsumer", *abi, common.FromHex(test_api_consumer_wrapper.TestAPIConsumerMetaData.Bin), - common.HexToAddress(linkAddr), - ) - - if err != nil { - return &EthereumAPIConsumer{}, fmt.Errorf("TestAPIConsumer instance deployment have failed: %w", err) - } - - consumer, err := test_api_consumer_wrapper.NewTestAPIConsumer(consumerDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumAPIConsumer{}, fmt.Errorf("failed to instantiate TestAPIConsumer instance: %w", err) - } - - return &EthereumAPIConsumer{ - client: seth, - address: &consumerDeploymentData.Address, - consumer: consumer, - }, nil -} - -// EthereumAPIConsumer API consumer for job type "directrequest" tests -type EthereumAPIConsumer struct { - address *common.Address - client *seth.Client - consumer *test_api_consumer_wrapper.TestAPIConsumer -} - -func (e *EthereumAPIConsumer) Address() string { - return e.address.Hex() -} - -func (e *EthereumAPIConsumer) RoundID(ctx context.Context) (*big.Int, error) { - return e.consumer.CurrentRoundID(&bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - }) -} - -func (e *EthereumAPIConsumer) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -func (e *EthereumAPIConsumer) Data(ctx context.Context) (*big.Int, error) { - return e.consumer.Data(&bind.CallOpts{ - From: e.client.Addresses[0], - Context: ctx, - }) -} - -// CreateRequestTo creates request to an oracle for particular jobID with params -func (e *EthereumAPIConsumer) CreateRequestTo( - oracleAddr string, - jobID [32]byte, - payment *big.Int, - url string, - path string, - times *big.Int, -) error { - _, err := e.client.Decode(e.consumer.CreateRequestTo(e.client.NewTXOpts(), common.HexToAddress(oracleAddr), jobID, payment, url, path, times)) - return err -} - -// EthereumMockETHLINKFeed represents mocked ETH/LINK feed contract -type EthereumMockETHLINKFeed struct { - client *seth.Client - feed *mock_ethlink_aggregator_wrapper.MockETHLINKAggregator - address *common.Address -} - -func (v *EthereumMockETHLINKFeed) Address() string { - return v.address.Hex() -} - -func (v *EthereumMockETHLINKFeed) LatestRoundData() (*big.Int, error) { - data, err := v.feed.LatestRoundData(&bind.CallOpts{ - From: v.client.Addresses[0], - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.Ans, nil -} - -func (v *EthereumMockETHLINKFeed) LatestRoundDataUpdatedAt() (*big.Int, error) { - data, err := v.feed.LatestRoundData(&bind.CallOpts{ - From: v.client.Addresses[0], - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.UpdatedAt, nil -} - -func DeployMockLINKETHFeed(client *seth.Client, answer *big.Int) (MockLINKETHFeed, error) { - abi, err := mock_ethlink_aggregator_wrapper.MockETHLINKAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockETHLINKFeed{}, fmt.Errorf("failed to get MockLINKETHFeed ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "MockLINKETHFeed", *abi, common.FromHex(mock_ethlink_aggregator_wrapper.MockETHLINKAggregatorMetaData.Bin), answer) - if err != nil { - return &EthereumMockETHLINKFeed{}, fmt.Errorf("MockLINKETHFeed instance deployment have failed: %w", err) - } - - instance, err := mock_ethlink_aggregator_wrapper.NewMockETHLINKAggregator(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockETHLINKFeed{}, fmt.Errorf("failed to instantiate MockLINKETHFeed instance: %w", err) - } - - return &EthereumMockETHLINKFeed{ - address: &data.Address, - client: client, - feed: instance, - }, nil -} - -func LoadMockLINKETHFeed(client *seth.Client, address common.Address) (MockLINKETHFeed, error) { - abi, err := mock_ethlink_aggregator_wrapper.MockETHLINKAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockETHLINKFeed{}, fmt.Errorf("failed to get MockLINKETHFeed ABI: %w", err) - } - client.ContractStore.AddABI("MockLINKETHFeed", *abi) - client.ContractStore.AddBIN("MockLINKETHFeed", common.FromHex(mock_ethlink_aggregator_wrapper.MockETHLINKAggregatorMetaData.Bin)) - - instance, err := mock_ethlink_aggregator_wrapper.NewMockETHLINKAggregator(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockETHLINKFeed{}, fmt.Errorf("failed to instantiate MockLINKETHFeed instance: %w", err) - } - - return &EthereumMockETHLINKFeed{ - address: &address, - client: client, - feed: instance, - }, nil -} - -// EthereumMockGASFeed represents mocked Gas feed contract -type EthereumMockGASFeed struct { - client *seth.Client - feed *mock_gas_aggregator_wrapper.MockGASAggregator - address *common.Address -} - -func (v *EthereumMockGASFeed) Address() string { - return v.address.Hex() -} - -func DeployMockGASFeed(client *seth.Client, answer *big.Int) (MockGasFeed, error) { - abi, err := mock_gas_aggregator_wrapper.MockGASAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockGASFeed{}, fmt.Errorf("failed to get MockGasFeed ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "MockGasFeed", *abi, common.FromHex(mock_gas_aggregator_wrapper.MockGASAggregatorMetaData.Bin), answer) - if err != nil { - return &EthereumMockGASFeed{}, fmt.Errorf("MockGasFeed instance deployment have failed: %w", err) - } - - instance, err := mock_gas_aggregator_wrapper.NewMockGASAggregator(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockGASFeed{}, fmt.Errorf("failed to instantiate MockGasFeed instance: %w", err) - } - - return &EthereumMockGASFeed{ - address: &data.Address, - client: client, - feed: instance, - }, nil -} - -func LoadMockGASFeed(client *seth.Client, address common.Address) (MockGasFeed, error) { - abi, err := mock_gas_aggregator_wrapper.MockGASAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockGASFeed{}, fmt.Errorf("failed to get MockGasFeed ABI: %w", err) - } - client.ContractStore.AddABI("MockGasFeed", *abi) - client.ContractStore.AddBIN("MockGasFeed", common.FromHex(mock_gas_aggregator_wrapper.MockGASAggregatorMetaData.Bin)) - - instance, err := mock_gas_aggregator_wrapper.NewMockGASAggregator(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockGASFeed{}, fmt.Errorf("failed to instantiate MockGasFeed instance: %w", err) - } - - return &EthereumMockGASFeed{ - address: &address, - client: client, - feed: instance, - }, nil -} - -func DeployMultiCallContract(client *seth.Client) (common.Address, error) { - abi, err := abi.JSON(strings.NewReader(MultiCallABI)) - if err != nil { - return common.Address{}, err - } - - data, err := client.DeployContract(client.NewTXOpts(), "MultiCall", abi, common.FromHex(MultiCallBIN)) - if err != nil { - return common.Address{}, fmt.Errorf("MultiCall instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -func LoadFunctionsCoordinator(seth *seth.Client, addr string) (FunctionsCoordinator, error) { - abi, err := functions_coordinator.FunctionsCoordinatorMetaData.GetAbi() - if err != nil { - return &EthereumFunctionsCoordinator{}, fmt.Errorf("failed to get FunctionsCoordinator ABI: %w", err) - } - seth.ContractStore.AddABI("FunctionsCoordinator", *abi) - seth.ContractStore.AddBIN("FunctionsCoordinator", common.FromHex(functions_coordinator.FunctionsCoordinatorMetaData.Bin)) - - instance, err := functions_coordinator.NewFunctionsCoordinator(common.HexToAddress(addr), seth.Client) - if err != nil { - return &EthereumFunctionsCoordinator{}, fmt.Errorf("failed to instantiate FunctionsCoordinator instance: %w", err) - } - - return &EthereumFunctionsCoordinator{ - client: seth, - instance: instance, - address: common.HexToAddress(addr), - }, err -} - -type EthereumFunctionsCoordinator struct { - address common.Address - client *seth.Client - instance *functions_coordinator.FunctionsCoordinator -} - -func (e *EthereumFunctionsCoordinator) GetThresholdPublicKey() ([]byte, error) { - return e.instance.GetThresholdPublicKey(e.client.NewCallOpts()) -} - -func (e *EthereumFunctionsCoordinator) GetDONPublicKey() ([]byte, error) { - return e.instance.GetDONPublicKey(e.client.NewCallOpts()) -} - -func (e *EthereumFunctionsCoordinator) Address() string { - return e.address.Hex() -} - -func LoadFunctionsRouter(l zerolog.Logger, seth *seth.Client, addr string) (FunctionsRouter, error) { - abi, err := functions_router.FunctionsRouterMetaData.GetAbi() - if err != nil { - return &EthereumFunctionsRouter{}, fmt.Errorf("failed to get FunctionsRouter ABI: %w", err) - } - seth.ContractStore.AddABI("FunctionsRouter", *abi) - seth.ContractStore.AddBIN("FunctionsRouter", common.FromHex(functions_router.FunctionsRouterMetaData.Bin)) - - instance, err := functions_router.NewFunctionsRouter(common.HexToAddress(addr), seth.Client) - if err != nil { - return &EthereumFunctionsRouter{}, fmt.Errorf("failed to instantiate FunctionsRouter instance: %w", err) - } - - return &EthereumFunctionsRouter{ - client: seth, - instance: instance, - address: common.HexToAddress(addr), - l: l, - }, err -} - -type EthereumFunctionsRouter struct { - address common.Address - client *seth.Client - instance *functions_router.FunctionsRouter - l zerolog.Logger -} - -func (e *EthereumFunctionsRouter) Address() string { - return e.address.Hex() -} - -func (e *EthereumFunctionsRouter) CreateSubscriptionWithConsumer(consumer string) (uint64, error) { - tx, err := e.client.Decode(e.instance.CreateSubscriptionWithConsumer(e.client.NewTXOpts(), common.HexToAddress(consumer))) - if err != nil { - return 0, err - } - - if tx.Receipt == nil { - return 0, errors.New("transaction did not err, but the receipt is nil") - } - for _, l := range tx.Receipt.Logs { - e.l.Info().Interface("Log", common.Bytes2Hex(l.Data)).Send() - } - topicsMap := map[string]any{} - - fabi, err := abi.JSON(strings.NewReader(functions_router.FunctionsRouterABI)) - if err != nil { - return 0, err - } - for _, ev := range fabi.Events { - e.l.Info().Str("EventName", ev.Name).Send() - } - topicOneInputs := abi.Arguments{fabi.Events["SubscriptionCreated"].Inputs[0]} - topicOneHash := []common.Hash{tx.Receipt.Logs[0].Topics[1:][0]} - if err := abi.ParseTopicsIntoMap(topicsMap, topicOneInputs, topicOneHash); err != nil { - return 0, fmt.Errorf("failed to decode topic value, err: %w", err) - } - e.l.Info().Interface("NewTopicsDecoded", topicsMap).Send() - if topicsMap["subscriptionId"] == 0 { - return 0, errors.New("failed to decode subscription ID after creation") - } - return topicsMap["subscriptionId"].(uint64), nil -} - -func DeployFunctionsLoadTestClient(seth *seth.Client, router string) (FunctionsLoadTestClient, error) { - operatorAbi, err := functions_load_test_client.FunctionsLoadTestClientMetaData.GetAbi() - if err != nil { - return &EthereumFunctionsLoadTestClient{}, fmt.Errorf("failed to get FunctionsLoadTestClient ABI: %w", err) - } - data, err := seth.DeployContract(seth.NewTXOpts(), "FunctionsLoadTestClient", *operatorAbi, common.FromHex(functions_load_test_client.FunctionsLoadTestClientMetaData.Bin), common.HexToAddress(router)) - if err != nil { - return &EthereumFunctionsLoadTestClient{}, fmt.Errorf("FunctionsLoadTestClient instance deployment have failed: %w", err) - } - - instance, err := functions_load_test_client.NewFunctionsLoadTestClient(data.Address, seth.Client) - if err != nil { - return &EthereumFunctionsLoadTestClient{}, fmt.Errorf("failed to instantiate FunctionsLoadTestClient instance: %w", err) - } - - return &EthereumFunctionsLoadTestClient{ - client: seth, - instance: instance, - address: data.Address, - }, nil -} - -// LoadFunctionsLoadTestClient returns deployed on given address FunctionsLoadTestClient contract instance -func LoadFunctionsLoadTestClient(seth *seth.Client, addr string) (FunctionsLoadTestClient, error) { - abi, err := functions_load_test_client.FunctionsLoadTestClientMetaData.GetAbi() - if err != nil { - return &EthereumFunctionsLoadTestClient{}, fmt.Errorf("failed to get FunctionsLoadTestClient ABI: %w", err) - } - seth.ContractStore.AddABI("FunctionsLoadTestClient", *abi) - seth.ContractStore.AddBIN("FunctionsLoadTestClient", common.FromHex(functions_load_test_client.FunctionsLoadTestClientMetaData.Bin)) - - instance, err := functions_load_test_client.NewFunctionsLoadTestClient(common.HexToAddress(addr), seth.Client) - if err != nil { - return &EthereumFunctionsLoadTestClient{}, fmt.Errorf("failed to instantiate FunctionsLoadTestClient instance: %w", err) - } - - return &EthereumFunctionsLoadTestClient{ - client: seth, - instance: instance, - address: common.HexToAddress(addr), - }, err -} - -type EthereumFunctionsLoadTestClient struct { - address common.Address - client *seth.Client - instance *functions_load_test_client.FunctionsLoadTestClient -} - -func (e *EthereumFunctionsLoadTestClient) Address() string { - return e.address.Hex() -} - -func (e *EthereumFunctionsLoadTestClient) GetStats() (*EthereumFunctionsLoadStats, error) { - lr, lbody, lerr, total, succeeded, errored, empty, err := e.instance.GetStats(e.client.NewCallOpts()) - if err != nil { - return nil, err - } - return &EthereumFunctionsLoadStats{ - LastRequestID: string(Bytes32ToSlice(lr)), - LastResponse: string(lbody), - LastError: string(lerr), - Total: total, - Succeeded: succeeded, - Errored: errored, - Empty: empty, - }, nil -} - -func (e *EthereumFunctionsLoadTestClient) ResetStats() error { - _, err := e.client.Decode(e.instance.ResetStats(e.client.NewTXOpts())) - return err -} - -func (e *EthereumFunctionsLoadTestClient) SendRequest(times uint32, source string, encryptedSecretsReferences []byte, args []string, subscriptionId uint64, jobId [32]byte) error { - _, err := e.client.Decode(e.instance.SendRequest(e.client.NewTXOpts(), times, source, encryptedSecretsReferences, args, subscriptionId, jobId)) - return err -} - -func (e *EthereumFunctionsLoadTestClient) SendRequestWithDONHostedSecrets(times uint32, source string, slotID uint8, slotVersion uint64, args []string, subscriptionId uint64, donID [32]byte) error { - _, err := e.client.Decode(e.instance.SendRequestWithDONHostedSecrets(e.client.NewTXOpts(), times, source, slotID, slotVersion, args, subscriptionId, donID)) - return err -} - -// EthereumWETHToken represents a WETH address -type EthereumWETHToken struct { - client *seth.Client - instance *weth9.WETH9 - address common.Address - l zerolog.Logger -} - -func DeployWETHTokenContract(l zerolog.Logger, client *seth.Client) (*EthereumWETHToken, error) { - wethTokenAbi, err := weth9.WETH9MetaData.GetAbi() - if err != nil { - return &EthereumWETHToken{}, fmt.Errorf("failed to get WETH token ABI: %w", err) - } - wethDeploymentData, err := client.DeployContract(client.NewTXOpts(), "WETHToken", *wethTokenAbi, common.FromHex(weth9.WETH9MetaData.Bin)) - if err != nil { - return &EthereumWETHToken{}, fmt.Errorf("WETH token instance deployment failed: %w", err) - } - - wethToken, err := weth9.NewWETH9(wethDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumWETHToken{}, fmt.Errorf("failed to instantiate WETHToken instance: %w", err) - } - - return &EthereumWETHToken{ - client: client, - instance: wethToken, - address: wethDeploymentData.Address, - l: l, - }, nil -} - -func LoadWETHTokenContract(l zerolog.Logger, client *seth.Client, address common.Address) (*EthereumWETHToken, error) { - abi, err := weth9.WETH9MetaData.GetAbi() - if err != nil { - return &EthereumWETHToken{}, fmt.Errorf("failed to get WETH token ABI: %w", err) - } - - client.ContractStore.AddABI("WETHToken", *abi) - client.ContractStore.AddBIN("WETHToken", common.FromHex(weth9.WETH9MetaData.Bin)) - - wethToken, err := weth9.NewWETH9(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumWETHToken{}, fmt.Errorf("failed to instantiate WETHToken instance: %w", err) - } - - return &EthereumWETHToken{ - client: client, - instance: wethToken, - address: address, - l: l, - }, nil -} - -// Fund the WETH Token contract with ETH to distribute the token -func (l *EthereumWETHToken) Fund(_ *big.Float) error { - panic("do not use this function, use actions_seth.SendFunds instead") -} - -func (l *EthereumWETHToken) Decimals() uint { - return 18 -} - -func (l *EthereumWETHToken) BalanceOf(ctx context.Context, addr string) (*big.Int, error) { - return l.instance.BalanceOf(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: ctx, - }, common.HexToAddress(addr)) -} - -// Name returns the name of the weth token -func (l *EthereumWETHToken) Name(ctx context.Context) (string, error) { - return l.instance.Name(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: ctx, - }) -} - -func (l *EthereumWETHToken) Address() string { - return l.address.Hex() -} - -func (l *EthereumWETHToken) Approve(to string, amount *big.Int) error { - l.l.Info(). - Str("From", l.client.Addresses[0].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Approving WETH Transfer") - _, err := l.client.Decode(l.instance.Approve(l.client.NewTXOpts(), common.HexToAddress(to), amount)) - return err -} - -func (l *EthereumWETHToken) Transfer(to string, amount *big.Int) error { - l.l.Info(). - Str("From", l.client.Addresses[0].Hex()). - Str("To", to). - Str("Amount", amount.String()). - Msg("Transferring WETH") - _, err := l.client.Decode(l.instance.Transfer(l.client.NewTXOpts(), common.HexToAddress(to), amount)) - return err -} - -// EthereumMockETHUSDFeed represents mocked ETH/USD feed contract -// For the integration tests, we also use this ETH/USD feed for LINK/USD feed since they have the same structure -type EthereumMockETHUSDFeed struct { - client *seth.Client - feed *mock_ethusd_aggregator_wrapper.MockETHUSDAggregator - address *common.Address -} - -func (l *EthereumMockETHUSDFeed) Decimals() uint { - return 8 -} - -func (l *EthereumMockETHUSDFeed) Address() string { - return l.address.Hex() -} - -func (l *EthereumMockETHUSDFeed) LatestRoundData() (*big.Int, error) { - data, err := l.feed.LatestRoundData(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.Ans, nil -} - -func (l *EthereumMockETHUSDFeed) LatestRoundDataUpdatedAt() (*big.Int, error) { - data, err := l.feed.LatestRoundData(&bind.CallOpts{ - From: l.client.Addresses[0], - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.UpdatedAt, nil -} - -func DeployMockETHUSDFeed(client *seth.Client, answer *big.Int) (MockETHUSDFeed, error) { - abi, err := mock_ethusd_aggregator_wrapper.MockETHUSDAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockETHUSDFeed{}, fmt.Errorf("failed to get MockETHUSDFeed ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "MockETHUSDFeed", *abi, common.FromHex(mock_ethusd_aggregator_wrapper.MockETHUSDAggregatorMetaData.Bin), answer) - if err != nil { - return &EthereumMockETHUSDFeed{}, fmt.Errorf("MockETHUSDFeed instance deployment have failed: %w", err) - } - - instance, err := mock_ethusd_aggregator_wrapper.NewMockETHUSDAggregator(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockETHUSDFeed{}, fmt.Errorf("failed to instantiate MockETHUSDFeed instance: %w", err) - } - - return &EthereumMockETHUSDFeed{ - address: &data.Address, - client: client, - feed: instance, - }, nil -} - -func LoadMockETHUSDFeed(client *seth.Client, address common.Address) (MockETHUSDFeed, error) { - abi, err := mock_ethusd_aggregator_wrapper.MockETHUSDAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumMockETHUSDFeed{}, fmt.Errorf("failed to get MockETHUSDFeed ABI: %w", err) - } - client.ContractStore.AddABI("MockETHUSDFeed", *abi) - client.ContractStore.AddBIN("MockETHUSDFeed", common.FromHex(mock_ethusd_aggregator_wrapper.MockETHUSDAggregatorMetaData.Bin)) - - instance, err := mock_ethusd_aggregator_wrapper.NewMockETHUSDAggregator(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumMockETHUSDFeed{}, fmt.Errorf("failed to instantiate MockETHUSDFeed instance: %w", err) - } - - return &EthereumMockETHUSDFeed{ - address: &address, - client: client, - feed: instance, - }, nil -} - -type Counter struct { - client *seth.Client - instance *counter.Counter - address common.Address -} - -func DeployCounterContract(client *seth.Client) (*Counter, error) { - abi, err := counter.CounterMetaData.GetAbi() - if err != nil { - return &Counter{}, fmt.Errorf("failed to get Counter ABI: %w", err) - } - linkDeploymentData, err := client.DeployContract(client.NewTXOpts(), "Counter", *abi, common.FromHex(counter.CounterMetaData.Bin)) - if err != nil { - return &Counter{}, fmt.Errorf("Counter instance deployment have failed: %w", err) - } - - instance, err := counter.NewCounter(linkDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &Counter{}, fmt.Errorf("failed to instantiate Counter instance: %w", err) - } - - return &Counter{ - client: client, - instance: instance, - address: linkDeploymentData.Address, - }, nil -} - -func (c *Counter) Address() string { - return c.address.Hex() -} - -func (c *Counter) Increment() error { - _, err := c.client.Decode(c.instance.Increment( - c.client.NewTXOpts(), - )) - return err -} - -func (c *Counter) Reset() error { - _, err := c.client.Decode(c.instance.Reset( - c.client.NewTXOpts(), - )) - return err -} - -func (c *Counter) Count() (*big.Int, error) { - data, err := c.instance.Count(&bind.CallOpts{ - From: c.client.Addresses[0], - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data, nil -} diff --git a/integration-tests/contracts/ethereum_contracts_atlas.go b/integration-tests/contracts/ethereum_contracts_atlas.go deleted file mode 100644 index 90bd6215b0e..00000000000 --- a/integration-tests/contracts/ethereum_contracts_atlas.go +++ /dev/null @@ -1,393 +0,0 @@ -package contracts - -import ( - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/functions/generated/functions_v1_events_mock" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/gas_wrapper_mock" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registrar_wrapper1_2_mock" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_1_mock" - eth_contracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" -) - -// EthereumFunctionsV1EventsMock represents the basic functions v1 events mock contract -type EthereumFunctionsV1EventsMock struct { - client *seth.Client - eventsMock *functions_v1_events_mock.FunctionsV1EventsMock - address *common.Address -} - -func (f *EthereumFunctionsV1EventsMock) Address() string { - return f.address.Hex() -} - -func (f *EthereumFunctionsV1EventsMock) EmitRequestProcessed(requestId [32]byte, subscriptionId uint64, totalCostJuels *big.Int, transmitter common.Address, resultCode uint8, response []byte, errByte []byte, callbackReturnData []byte) error { - _, err := f.client.Decode(f.eventsMock.EmitRequestProcessed(f.client.NewTXOpts(), requestId, subscriptionId, totalCostJuels, transmitter, resultCode, response, errByte, callbackReturnData)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitRequestStart(requestId [32]byte, donId [32]byte, subscriptionId uint64, subscriptionOwner common.Address, requestingContract common.Address, requestInitiator common.Address, data []byte, dataVersion uint16, callbackGasLimit uint32, estimatedTotalCostJuels *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitRequestStart(f.client.NewTXOpts(), requestId, donId, subscriptionId, subscriptionOwner, requestingContract, requestInitiator, data, dataVersion, callbackGasLimit, estimatedTotalCostJuels)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionCanceled(subscriptionId uint64, fundsRecipient common.Address, fundsAmount *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionCanceled(f.client.NewTXOpts(), subscriptionId, fundsRecipient, fundsAmount)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionConsumerAdded(subscriptionId uint64, consumer common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionConsumerAdded(f.client.NewTXOpts(), subscriptionId, consumer)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionConsumerRemoved(subscriptionId uint64, consumer common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionConsumerRemoved(f.client.NewTXOpts(), subscriptionId, consumer)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionCreated(subscriptionId uint64, owner common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionCreated(f.client.NewTXOpts(), subscriptionId, owner)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionFunded(subscriptionId uint64, oldBalance *big.Int, newBalance *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionFunded(f.client.NewTXOpts(), subscriptionId, oldBalance, newBalance)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionOwnerTransferred(subscriptionId uint64, from common.Address, to common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionOwnerTransferred(f.client.NewTXOpts(), subscriptionId, from, to)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitSubscriptionOwnerTransferRequested(subscriptionId uint64, from common.Address, to common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitSubscriptionOwnerTransferRequested(f.client.NewTXOpts(), subscriptionId, from, to)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitRequestNotProcessed(requestId [32]byte, coordinator common.Address, transmitter common.Address, resultCode uint8) error { - _, err := f.client.Decode(f.eventsMock.EmitRequestNotProcessed(f.client.NewTXOpts(), requestId, coordinator, transmitter, resultCode)) - return err -} - -func (f *EthereumFunctionsV1EventsMock) EmitContractUpdated(id [32]byte, from common.Address, to common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitContractUpdated(f.client.NewTXOpts(), id, from, to)) - return err -} - -// DeployFunctionsV1EventsMock deploys a new instance of the FunctionsV1EventsMock contract -func DeployFunctionsV1EventsMock(client *seth.Client) (FunctionsV1EventsMock, error) { - abi, err := functions_v1_events_mock.FunctionsV1EventsMockMetaData.GetAbi() - if err != nil { - return &EthereumFunctionsV1EventsMock{}, fmt.Errorf("failed to get FunctionsV1EventsMock ABI: %w", err) - } - client.ContractStore.AddABI("FunctionsV1EventsMock", *abi) - client.ContractStore.AddBIN("FunctionsV1EventsMock", common.FromHex(functions_v1_events_mock.FunctionsV1EventsMockMetaData.Bin)) - - data, err := client.DeployContract(client.NewTXOpts(), "FunctionsV1EventsMock", *abi, common.FromHex(functions_v1_events_mock.FunctionsV1EventsMockMetaData.Bin)) - - if err != nil { - return &EthereumFunctionsV1EventsMock{}, fmt.Errorf("FunctionsV1EventsMock instance deployment have failed: %w", err) - } - - instance, err := functions_v1_events_mock.NewFunctionsV1EventsMock(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumFunctionsV1EventsMock{}, fmt.Errorf("failed to instantiate FunctionsV1EventsMock instance: %w", err) - } - - return &EthereumFunctionsV1EventsMock{ - client: client, - eventsMock: instance, - address: &data.Address, - }, nil -} - -// EthereumKeeperRegistry11Mock represents the basic keeper registry 1.1 mock contract -type EthereumKeeperRegistry11Mock struct { - client *seth.Client - registryMock *keeper_registry_wrapper1_1_mock.KeeperRegistryMock - address *common.Address -} - -func (f *EthereumKeeperRegistry11Mock) Address() string { - return f.address.Hex() -} - -func (f *EthereumKeeperRegistry11Mock) EmitUpkeepPerformed(id *big.Int, success bool, from common.Address, payment *big.Int, performData []byte) error { - _, err := f.client.Decode(f.registryMock.EmitUpkeepPerformed(f.client.NewTXOpts(), id, success, from, payment, performData)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) EmitUpkeepCanceled(id *big.Int, atBlockHeight uint64) error { - _, err := f.client.Decode(f.registryMock.EmitUpkeepCanceled(f.client.NewTXOpts(), id, atBlockHeight)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) EmitFundsWithdrawn(id *big.Int, amount *big.Int, to common.Address) error { - _, err := f.client.Decode(f.registryMock.EmitFundsWithdrawn(f.client.NewTXOpts(), id, amount, to)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) EmitKeepersUpdated(keepers []common.Address, payees []common.Address) error { - _, err := f.client.Decode(f.registryMock.EmitKeepersUpdated(f.client.NewTXOpts(), keepers, payees)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) EmitUpkeepRegistered(id *big.Int, executeGas uint32, admin common.Address) error { - _, err := f.client.Decode(f.registryMock.EmitUpkeepRegistered(f.client.NewTXOpts(), id, executeGas, admin)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) EmitFundsAdded(id *big.Int, from common.Address, amount *big.Int) error { - _, err := f.client.Decode(f.registryMock.EmitFundsAdded(f.client.NewTXOpts(), id, from, amount)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetUpkeepCount(upkeepCount *big.Int) error { - _, err := f.client.Decode(f.registryMock.SetUpkeepCount(f.client.NewTXOpts(), upkeepCount)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetCanceledUpkeepList(canceledUpkeepList []*big.Int) error { - _, err := f.client.Decode(f.registryMock.SetCanceledUpkeepList(f.client.NewTXOpts(), canceledUpkeepList)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetKeeperList(keepers []common.Address) error { - _, err := f.client.Decode(f.registryMock.SetKeeperList(f.client.NewTXOpts(), keepers)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetConfig(paymentPremiumPPB uint32, flatFeeMicroLink uint32, blockCountPerTurn *big.Int, checkGasLimit uint32, stalenessSeconds *big.Int, gasCeilingMultiplier uint16, fallbackGasPrice *big.Int, fallbackLinkPrice *big.Int) error { - _, err := f.client.Decode(f.registryMock.SetConfig(f.client.NewTXOpts(), paymentPremiumPPB, flatFeeMicroLink, blockCountPerTurn, checkGasLimit, stalenessSeconds, gasCeilingMultiplier, fallbackGasPrice, fallbackLinkPrice)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetUpkeep(id *big.Int, target common.Address, executeGas uint32, balance *big.Int, admin common.Address, maxValidBlocknumber uint64, lastKeeper common.Address, checkData []byte) error { - _, err := f.client.Decode(f.registryMock.SetUpkeep(f.client.NewTXOpts(), id, target, executeGas, balance, admin, maxValidBlocknumber, lastKeeper, checkData)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetMinBalance(id *big.Int, minBalance *big.Int) error { - _, err := f.client.Decode(f.registryMock.SetMinBalance(f.client.NewTXOpts(), id, minBalance)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetCheckUpkeepData(id *big.Int, performData []byte, maxLinkPayment *big.Int, gasLimit *big.Int, adjustedGasWei *big.Int, linkEth *big.Int) error { - _, err := f.client.Decode(f.registryMock.SetCheckUpkeepData(f.client.NewTXOpts(), id, performData, maxLinkPayment, gasLimit, adjustedGasWei, linkEth)) - return err -} - -func (f *EthereumKeeperRegistry11Mock) SetPerformUpkeepSuccess(id *big.Int, success bool) error { - _, err := f.client.Decode(f.registryMock.SetPerformUpkeepSuccess(f.client.NewTXOpts(), id, success)) - return err -} - -func DeployKeeperRegistry11Mock(client *seth.Client) (KeeperRegistry11Mock, error) { - abi, err := keeper_registry_wrapper1_1_mock.KeeperRegistryMockMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry11Mock{}, fmt.Errorf("failed to get KeeperRegistry11Mock ABI: %w", err) - } - client.ContractStore.AddABI("KeeperRegistry11Mock", *abi) - client.ContractStore.AddBIN("KeeperRegistry11Mock", common.FromHex(keeper_registry_wrapper1_1_mock.KeeperRegistryMockMetaData.Bin)) - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry11Mock", *abi, common.FromHex(keeper_registry_wrapper1_1_mock.KeeperRegistryMockMetaData.Bin)) - - if err != nil { - return &EthereumKeeperRegistry11Mock{}, fmt.Errorf("KeeperRegistry11Mock instance deployment have failed: %w", err) - } - - instance, err := keeper_registry_wrapper1_1_mock.NewKeeperRegistryMock(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry11Mock{}, fmt.Errorf("failed to instantiate KeeperRegistry11Mock instance: %w", err) - } - - return &EthereumKeeperRegistry11Mock{ - client: client, - registryMock: instance, - address: &data.Address, - }, nil -} - -// EthereumKeeperRegistrar12Mock represents the basic keeper registrar 1.2 mock contract -type EthereumKeeperRegistrar12Mock struct { - client *seth.Client - registrarMock *keeper_registrar_wrapper1_2_mock.KeeperRegistrarMock - address *common.Address -} - -func (f *EthereumKeeperRegistrar12Mock) Address() string { - return f.address.Hex() -} - -func (f *EthereumKeeperRegistrar12Mock) EmitRegistrationRequested(hash [32]byte, name string, encryptedEmail []byte, upkeepContract common.Address, gasLimit uint32, adminAddress common.Address, checkData []byte, amount *big.Int, source uint8) error { - _, err := f.client.Decode(f.registrarMock.EmitRegistrationRequested(f.client.NewTXOpts(), hash, name, encryptedEmail, upkeepContract, gasLimit, adminAddress, checkData, amount, source)) - return err -} - -func (f *EthereumKeeperRegistrar12Mock) EmitRegistrationApproved(hash [32]byte, displayName string, upkeepId *big.Int) error { - _, err := f.client.Decode(f.registrarMock.EmitRegistrationApproved(f.client.NewTXOpts(), hash, displayName, upkeepId)) - return err -} - -func (f *EthereumKeeperRegistrar12Mock) SetRegistrationConfig(autoApproveConfigType uint8, autoApproveMaxAllowed uint32, approvedCount uint32, keeperRegistry common.Address, minLINKJuels *big.Int) error { - _, err := f.client.Decode(f.registrarMock.SetRegistrationConfig(f.client.NewTXOpts(), autoApproveConfigType, autoApproveMaxAllowed, approvedCount, keeperRegistry, minLINKJuels)) - return err -} - -func DeployKeeperRegistrar12Mock(client *seth.Client) (KeeperRegistrar12Mock, error) { - abi, err := keeper_registrar_wrapper1_2_mock.KeeperRegistrarMockMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistrar12Mock{}, fmt.Errorf("failed to get KeeperRegistrar12Mock ABI: %w", err) - } - client.ContractStore.AddABI("KeeperRegistrar12Mock", *abi) - client.ContractStore.AddBIN("KeeperRegistrar12Mock", common.FromHex(keeper_registrar_wrapper1_2_mock.KeeperRegistrarMockMetaData.Bin)) - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistrar12Mock", *abi, common.FromHex(keeper_registrar_wrapper1_2_mock.KeeperRegistrarMockMetaData.Bin)) - - if err != nil { - return &EthereumKeeperRegistrar12Mock{}, fmt.Errorf("KeeperRegistrar12Mock instance deployment have failed: %w", err) - } - - instance, err := keeper_registrar_wrapper1_2_mock.NewKeeperRegistrarMock(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistrar12Mock{}, fmt.Errorf("failed to instantiate KeeperRegistrar12Mock instance: %w", err) - } - - return &EthereumKeeperRegistrar12Mock{ - client: client, - registrarMock: instance, - address: &data.Address, - }, nil -} - -// EthereumKeeperGasWrapperMock represents the basic keeper gas wrapper mock contract -type EthereumKeeperGasWrapperMock struct { - client *seth.Client - gasWrapperMock *gas_wrapper_mock.KeeperRegistryCheckUpkeepGasUsageWrapperMock - address *common.Address -} - -func (f *EthereumKeeperGasWrapperMock) Address() string { - return f.address.Hex() -} - -func (f *EthereumKeeperGasWrapperMock) SetMeasureCheckGasResult(result bool, payload []byte, gas *big.Int) error { - _, err := f.client.Decode(f.gasWrapperMock.SetMeasureCheckGasResult(f.client.NewTXOpts(), result, payload, gas)) - return err -} - -func DeployKeeperGasWrapperMock(client *seth.Client) (KeeperGasWrapperMock, error) { - abi, err := gas_wrapper_mock.KeeperRegistryCheckUpkeepGasUsageWrapperMockMetaData.GetAbi() - if err != nil { - return &EthereumKeeperGasWrapperMock{}, fmt.Errorf("failed to get KeeperGasWrapperMock ABI: %w", err) - } - client.ContractStore.AddABI("KeeperGasWrapperMock", *abi) - client.ContractStore.AddBIN("KeeperGasWrapperMock", common.FromHex(gas_wrapper_mock.KeeperRegistryCheckUpkeepGasUsageWrapperMockMetaData.Bin)) - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperGasWrapperMock", *abi, common.FromHex(gas_wrapper_mock.KeeperRegistryCheckUpkeepGasUsageWrapperMockMetaData.Bin)) - - if err != nil { - return &EthereumKeeperGasWrapperMock{}, fmt.Errorf("KeeperGasWrapperMock instance deployment have failed: %w", err) - } - - instance, err := gas_wrapper_mock.NewKeeperRegistryCheckUpkeepGasUsageWrapperMock(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperGasWrapperMock{}, fmt.Errorf("failed to instantiate KeeperGasWrapperMock instance: %w", err) - } - - return &EthereumKeeperGasWrapperMock{ - client: client, - gasWrapperMock: instance, - address: &data.Address, - }, nil -} - -// EthereumStakingEventsMock represents the basic events mock contract -type EthereumStakingEventsMock struct { - client *seth.Client - eventsMock *eth_contracts.StakingEventsMock - address *common.Address -} - -func (f *EthereumStakingEventsMock) Address() string { - return f.address.Hex() -} - -func (f *EthereumStakingEventsMock) MaxCommunityStakeAmountIncreased(maxStakeAmount *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitMaxCommunityStakeAmountIncreased(f.client.NewTXOpts(), maxStakeAmount)) - return err -} - -func (f *EthereumStakingEventsMock) PoolSizeIncreased(maxPoolSize *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitPoolSizeIncreased(f.client.NewTXOpts(), maxPoolSize)) - return err -} - -func (f *EthereumStakingEventsMock) MaxOperatorStakeAmountIncreased(maxStakeAmount *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitMaxOperatorStakeAmountIncreased(f.client.NewTXOpts(), maxStakeAmount)) - return err -} - -func (f *EthereumStakingEventsMock) RewardInitialized(rate *big.Int, available *big.Int, startTimestamp *big.Int, endTimestamp *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitRewardInitialized(f.client.NewTXOpts(), rate, available, startTimestamp, endTimestamp)) - return err -} - -func (f *EthereumStakingEventsMock) AlertRaised(alerter common.Address, roundId *big.Int, rewardAmount *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitAlertRaised(f.client.NewTXOpts(), alerter, roundId, rewardAmount)) - return err -} - -func (f *EthereumStakingEventsMock) Staked(staker common.Address, newStake *big.Int, totalStake *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitStaked(f.client.NewTXOpts(), staker, newStake, totalStake)) - return err -} - -func (f *EthereumStakingEventsMock) OperatorAdded(operator common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitOperatorAdded(f.client.NewTXOpts(), operator)) - return err -} - -func (f *EthereumStakingEventsMock) OperatorRemoved(operator common.Address, amount *big.Int) error { - _, err := f.client.Decode(f.eventsMock.EmitOperatorRemoved(f.client.NewTXOpts(), operator, amount)) - return err -} - -func (f *EthereumStakingEventsMock) FeedOperatorsSet(feedOperators []common.Address) error { - _, err := f.client.Decode(f.eventsMock.EmitFeedOperatorsSet(f.client.NewTXOpts(), feedOperators)) - return err -} - -func DeployStakingEventsMock(client *seth.Client) (StakingEventsMock, error) { - abi, err := eth_contracts.StakingEventsMockMetaData.GetAbi() - if err != nil { - return &EthereumStakingEventsMock{}, fmt.Errorf("failed to get StakingEventsMock ABI: %w", err) - } - client.ContractStore.AddABI("StakingEventsMock", *abi) - client.ContractStore.AddBIN("StakingEventsMock", common.FromHex(eth_contracts.StakingEventsMockMetaData.Bin)) - - data, err := client.DeployContract(client.NewTXOpts(), "StakingEventsMock", *abi, common.FromHex(eth_contracts.StakingEventsMockMetaData.Bin)) - - if err != nil { - return &EthereumStakingEventsMock{}, fmt.Errorf("StakingEventsMock instance deployment have failed: %w", err) - } - - instance, err := eth_contracts.NewStakingEventsMock(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumStakingEventsMock{}, fmt.Errorf("failed to instantiate StakingEventsMock instance: %w", err) - } - - return &EthereumStakingEventsMock{ - client: client, - eventsMock: instance, - address: &data.Address, - }, nil -} diff --git a/integration-tests/contracts/ethereum_contracts_automation.go b/integration-tests/contracts/ethereum_contracts_automation.go deleted file mode 100644 index 56930630c7c..00000000000 --- a/integration-tests/contracts/ethereum_contracts_automation.go +++ /dev/null @@ -1,2964 +0,0 @@ -package contracts - -import ( - "context" - "errors" - "fmt" - "math/big" - "strconv" - "strings" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog" - - registrylogicc23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_logic_c_wrapper_2_3" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - eth_contracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/testreporters" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/arbitrum_module" - acutils "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_compatible_utils" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_consumer_benchmark" - automationForwarderLogic "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_forwarder_logic" - registrar21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registrar_wrapper2_1" - registrar23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registrar_wrapper2_3" - registrylogica22 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_logic_a_wrapper_2_2" - registrylogica23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_logic_a_wrapper_2_3" - registrylogicb22 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_logic_b_wrapper_2_2" - registrylogicb23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_logic_b_wrapper_2_3" - registry22 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_wrapper_2_2" - registry23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registry_wrapper_2_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/chain_module_base" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_2" - iregistry22 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" - iregistry23 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_chain_module" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" - iregistry21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_consumer_performance_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registrar_wrapper1_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registrar_wrapper2_0" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_logic1_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_logic2_0" - registrylogica21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_logic_a_wrapper_2_1" - registrylogicb21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_logic_b_wrapper_2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper1_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper2_0" - registry21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/keeper_registry_wrapper_2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/log_triggered_streams_lookup_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/log_upkeep_counter_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/optimism_module" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/perform_data_checker_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/scroll_module" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/simple_log_upkeep_counter_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/streams_lookup_upkeep_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/upkeep_counter_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/upkeep_perform_counter_restrictive_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/upkeep_transcoder" - cltypes "github.com/smartcontractkit/chainlink-evm/pkg/types" - "github.com/smartcontractkit/chainlink-evm/pkg/utils" -) - -// EthereumUpkeepTranscoder represents the transcoder which is used to perform migrations -// of upkeeps from one registry to another. -type EthereumUpkeepTranscoder struct { - client *seth.Client - transcoder *upkeep_transcoder.UpkeepTranscoder - address *common.Address -} - -func (v *EthereumUpkeepTranscoder) Address() string { - return v.address.Hex() -} - -func DeployUpkeepTranscoder(client *seth.Client) (*EthereumUpkeepTranscoder, error) { - abi, err := upkeep_transcoder.UpkeepTranscoderMetaData.GetAbi() - if err != nil { - return &EthereumUpkeepTranscoder{}, fmt.Errorf("failed to get UpkeepTranscoder ABI: %w", err) - } - transcoderDeploymentData, err := client.DeployContract(client.NewTXOpts(), "UpkeepTranscoder", *abi, common.FromHex(upkeep_transcoder.UpkeepTranscoderMetaData.Bin)) - if err != nil { - return &EthereumUpkeepTranscoder{}, fmt.Errorf("UpkeepTranscoder instance deployment have failed: %w", err) - } - - transcoder, err := upkeep_transcoder.NewUpkeepTranscoder(transcoderDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumUpkeepTranscoder{}, fmt.Errorf("failed to instantiate UpkeepTranscoder instance: %w", err) - } - - return &EthereumUpkeepTranscoder{ - client: client, - transcoder: transcoder, - address: &transcoderDeploymentData.Address, - }, nil -} - -func LoadUpkeepTranscoder(client *seth.Client, address common.Address) (*EthereumUpkeepTranscoder, error) { - abi, err := upkeep_transcoder.UpkeepTranscoderMetaData.GetAbi() - if err != nil { - return &EthereumUpkeepTranscoder{}, fmt.Errorf("failed to get UpkeepTranscoder ABI: %w", err) - } - - client.ContractStore.AddABI("UpkeepTranscoder", *abi) - client.ContractStore.AddBIN("UpkeepTranscoder", common.FromHex(upkeep_transcoder.UpkeepTranscoderMetaData.Bin)) - - transcoder, err := upkeep_transcoder.NewUpkeepTranscoder(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumUpkeepTranscoder{}, fmt.Errorf("failed to instantiate UpkeepTranscoder instance: %w", err) - } - - return &EthereumUpkeepTranscoder{ - client: client, - transcoder: transcoder, - address: &address, - }, nil -} - -// EthereumKeeperRegistry represents keeper registry contract -type EthereumKeeperRegistry struct { - client *seth.Client - version ethereum.KeeperRegistryVersion - registry1_1 *keeper_registry_wrapper1_1.KeeperRegistry - registry1_2 *keeper_registry_wrapper1_2.KeeperRegistry - registry1_3 *keeper_registry_wrapper1_3.KeeperRegistry - registry2_0 *keeper_registry_wrapper2_0.KeeperRegistry - registry2_1 *i_keeper_registry_master_wrapper_2_1.IKeeperRegistryMaster - registry2_2 *i_automation_registry_master_wrapper_2_2.IAutomationRegistryMaster - registry2_3 *i_automation_registry_master_wrapper_2_3.IAutomationRegistryMaster23 - chainModule *i_chain_module.IChainModule - address *common.Address - l zerolog.Logger -} - -func (v *EthereumKeeperRegistry) ReorgProtectionEnabled() bool { - chainId := v.client.ChainID - // reorg protection is disabled in polygon zkEVM and Scroll bc currently there is no way to get the block hash onchain - return v.version < ethereum.RegistryVersion_2_2 || (chainId != 1101 && chainId != 1442 && chainId != 2442 && chainId != 534352 && chainId != 534351) -} - -func (v *EthereumKeeperRegistry) ChainModuleAddress() common.Address { - if v.version >= ethereum.RegistryVersion_2_2 { - return v.chainModule.Address() - } - return common.Address{} -} - -func (v *EthereumKeeperRegistry) Address() string { - return v.address.Hex() -} - -func (v *EthereumKeeperRegistry) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} - -func (v *EthereumKeeperRegistry) RegistryOwnerAddress() common.Address { - callOpts := &bind.CallOpts{ - Pending: false, - } - - switch v.version { - case ethereum.RegistryVersion_2_3: - ownerAddress, _ := v.registry2_3.Owner(callOpts) - return ownerAddress - case ethereum.RegistryVersion_2_2: - ownerAddress, _ := v.registry2_2.Owner(callOpts) - return ownerAddress - case ethereum.RegistryVersion_2_1: - ownerAddress, _ := v.registry2_1.Owner(callOpts) - return ownerAddress - case ethereum.RegistryVersion_2_0: - ownerAddress, _ := v.registry2_0.Owner(callOpts) - return ownerAddress - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1, ethereum.RegistryVersion_1_2, ethereum.RegistryVersion_1_3: - return v.client.MustGetRootKeyAddress() - default: - return v.client.MustGetRootKeyAddress() - } -} - -func (v *EthereumKeeperRegistry) SetConfigTypeSafe(ocrConfig OCRv2Config) error { - txOpts := v.client.NewTXOpts() - var err error - var decodedTx *seth.DecodedTransaction - - switch v.version { - case ethereum.RegistryVersion_2_1: - decodedTx, err = v.client.Decode(v.registry2_1.SetConfigTypeSafe(txOpts, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.TypedOnchainConfig21, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - )) - case ethereum.RegistryVersion_2_2: - decodedTx, err = v.client.Decode(v.registry2_2.SetConfigTypeSafe(txOpts, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.TypedOnchainConfig22, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - )) - case ethereum.RegistryVersion_2_3: - decodedTx, err = v.client.Decode(v.registry2_3.SetConfigTypeSafe(txOpts, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.TypedOnchainConfig23, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - ocrConfig.BillingTokens, - ocrConfig.BillingConfigs, - )) - default: - return fmt.Errorf("SetConfigTypeSafe is not supported in keeper registry version %d", v.version) - } - v.l.Debug().Interface("decodedTx", decodedTx).Msg("SetConfigTypeSafe") - return err -} - -func (v *EthereumKeeperRegistry) SetConfig(config KeeperRegistrySettings, ocrConfig OCRv2Config) error { - txOpts := v.client.NewTXOpts() - callOpts := bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: nil, - } - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err := v.client.Decode(v.registry1_1.SetConfig( - txOpts, - config.PaymentPremiumPPB, - config.FlatFeeMicroLINK, - config.BlockCountPerTurn, - config.CheckGasLimit, - config.StalenessSeconds, - config.GasCeilingMultiplier, - config.FallbackGasPrice, - config.FallbackLinkPrice, - )) - return err - case ethereum.RegistryVersion_1_2: - state, err := v.registry1_2.GetState(&callOpts) - if err != nil { - return err - } - - _, err = v.client.Decode(v.registry1_2.SetConfig(txOpts, keeper_registry_wrapper1_2.Config{ - PaymentPremiumPPB: config.PaymentPremiumPPB, - FlatFeeMicroLink: config.FlatFeeMicroLINK, - BlockCountPerTurn: config.BlockCountPerTurn, - CheckGasLimit: config.CheckGasLimit, - StalenessSeconds: config.StalenessSeconds, - GasCeilingMultiplier: config.GasCeilingMultiplier, - MinUpkeepSpend: config.MinUpkeepSpend, - MaxPerformGas: config.MaxPerformGas, - FallbackGasPrice: config.FallbackGasPrice, - FallbackLinkPrice: config.FallbackLinkPrice, - // Keep the transcoder and registrar same. They have separate setters - Transcoder: state.Config.Transcoder, - Registrar: state.Config.Registrar, - })) - return err - case ethereum.RegistryVersion_1_3: - state, err := v.registry1_3.GetState(&callOpts) - if err != nil { - return err - } - - _, err = v.client.Decode(v.registry1_3.SetConfig(txOpts, keeper_registry_wrapper1_3.Config{ - PaymentPremiumPPB: config.PaymentPremiumPPB, - FlatFeeMicroLink: config.FlatFeeMicroLINK, - BlockCountPerTurn: config.BlockCountPerTurn, - CheckGasLimit: config.CheckGasLimit, - StalenessSeconds: config.StalenessSeconds, - GasCeilingMultiplier: config.GasCeilingMultiplier, - MinUpkeepSpend: config.MinUpkeepSpend, - MaxPerformGas: config.MaxPerformGas, - FallbackGasPrice: config.FallbackGasPrice, - FallbackLinkPrice: config.FallbackLinkPrice, - // Keep the transcoder and registrar same. They have separate setters - Transcoder: state.Config.Transcoder, - Registrar: state.Config.Registrar, - })) - return err - case ethereum.RegistryVersion_2_0: - _, err := v.client.Decode(v.registry2_0.SetConfig(txOpts, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.OnchainConfig, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - )) - return err - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - return errors.New("registry version 2.1 2.2 and 2.3 must use setConfigTypeSafe function") - default: - return fmt.Errorf("keeper registry version %d is not supported", v.version) - } -} - -func (v *EthereumKeeperRegistry) SetUpkeepOffchainConfig(id *big.Int, offchainConfig []byte) error { - switch v.version { - case ethereum.RegistryVersion_2_0: - _, err := v.client.Decode(v.registry2_0.SetUpkeepOffchainConfig(v.client.NewTXOpts(), id, offchainConfig)) - return err - case ethereum.RegistryVersion_2_1: - _, err := v.client.Decode(v.registry2_1.SetUpkeepOffchainConfig(v.client.NewTXOpts(), id, offchainConfig)) - return err - case ethereum.RegistryVersion_2_2: - _, err := v.client.Decode(v.registry2_2.SetUpkeepOffchainConfig(v.client.NewTXOpts(), id, offchainConfig)) - return err - case ethereum.RegistryVersion_2_3: - _, err := v.client.Decode(v.registry2_3.SetUpkeepOffchainConfig(v.client.NewTXOpts(), id, offchainConfig)) - return err - default: - return fmt.Errorf("SetUpkeepOffchainConfig is not supported by keeper registry version %d", v.version) - } -} - -// Pause pauses the registry. -func (v *EthereumKeeperRegistry) Pause() error { - txOpts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err = v.client.Decode(v.registry1_1.Pause(txOpts)) - case ethereum.RegistryVersion_1_2: - _, err = v.client.Decode(v.registry1_2.Pause(txOpts)) - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.Pause(txOpts)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.Pause(txOpts)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.Pause(txOpts)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.Pause(txOpts)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.Pause(txOpts)) - default: - return fmt.Errorf("keeper registry version %d is not supported", v.version) - } - - return err -} - -// Migrate performs a migration of the given upkeep ids to the specific destination passed as parameter. -func (v *EthereumKeeperRegistry) Migrate(upkeepIDs []*big.Int, destinationAddress common.Address) error { - if v.version != ethereum.RegistryVersion_1_2 { - return errors.New("migration of upkeeps is only available for version 1.2 of the registries") - } - - _, err := v.client.Decode(v.registry1_2.MigrateUpkeeps(v.client.NewTXOpts(), upkeepIDs, destinationAddress)) - return err -} - -// SetMigrationPermissions sets the permissions of another registry to allow migrations between the two. -func (v *EthereumKeeperRegistry) SetMigrationPermissions(peerAddress common.Address, permission uint8) error { - if v.version != ethereum.RegistryVersion_1_2 { - return errors.New("migration of upkeeps is only available for version 1.2 of the registries") - } - - _, err := v.client.Decode(v.registry1_2.SetPeerRegistryMigrationPermission(v.client.NewTXOpts(), peerAddress, permission)) - return err -} - -func (v *EthereumKeeperRegistry) SetRegistrar(registrarAddr string) error { - if v.version == ethereum.RegistryVersion_2_0 { - // we short circuit and exit, so we don't create a new txs messing up the nonce before exiting - return errors.New("please use set config") - } - - txOpts := v.client.NewTXOpts() - callOpts := bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: nil, - } - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err := v.client.Decode(v.registry1_1.SetRegistrar(txOpts, common.HexToAddress(registrarAddr))) - return err - case ethereum.RegistryVersion_1_2: - state, err := v.registry1_2.GetState(&callOpts) - if err != nil { - return err - } - newConfig := state.Config - newConfig.Registrar = common.HexToAddress(registrarAddr) - _, err = v.client.Decode(v.registry1_2.SetConfig(txOpts, newConfig)) - return err - case ethereum.RegistryVersion_1_3: - state, err := v.registry1_3.GetState(&callOpts) - if err != nil { - return err - } - newConfig := state.Config - newConfig.Registrar = common.HexToAddress(registrarAddr) - _, err = v.client.Decode(v.registry1_3.SetConfig(txOpts, newConfig)) - return err - default: - return fmt.Errorf("keeper registry version %d is not supported", v.version) - } -} - -// AddUpkeepFunds adds link for particular upkeep id -func (v *EthereumKeeperRegistry) AddUpkeepFundsFromKey(id *big.Int, amount *big.Int, keyNum int) error { - opts := v.client.NewTXKeyOpts(keyNum) - var err error - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err = v.client.Decode(v.registry1_1.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_1_2: - _, err = v.client.Decode(v.registry1_2.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.AddFunds(opts, id, amount)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.AddFunds(opts, id, amount)) - } - - return err -} - -// AddUpkeepFunds adds link for particular upkeep id -func (v *EthereumKeeperRegistry) AddUpkeepFunds(id *big.Int, amount *big.Int) error { - return v.AddUpkeepFundsFromKey(id, amount, 0) -} - -// GetUpkeepInfo gets upkeep info -func (v *EthereumKeeperRegistry) GetUpkeepInfo(ctx context.Context, id *big.Int) (*UpkeepInfo, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - uk, err := v.registry1_1.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.ExecuteGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - LastKeeper: uk.LastKeeper.Hex(), - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - }, nil - case ethereum.RegistryVersion_1_2: - uk, err := v.registry1_2.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.ExecuteGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - LastKeeper: uk.LastKeeper.Hex(), - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - }, nil - case ethereum.RegistryVersion_1_3: - uk, err := v.registry1_3.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.ExecuteGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - LastKeeper: uk.LastKeeper.Hex(), - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - }, nil - case ethereum.RegistryVersion_2_0: - uk, err := v.registry2_0.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.ExecuteGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - LastPerformBlockNumber: uk.LastPerformBlockNumber, - AmountSpent: uk.AmountSpent, - Paused: uk.Paused, - OffchainConfig: uk.OffchainConfig, - }, nil - case ethereum.RegistryVersion_2_1: - uk, err := v.registry2_1.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.PerformGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - LastPerformBlockNumber: uk.LastPerformedBlockNumber, - AmountSpent: uk.AmountSpent, - Paused: uk.Paused, - OffchainConfig: uk.OffchainConfig, - }, nil - case ethereum.RegistryVersion_2_2: - return v.getUpkeepInfo22(opts, id) - case ethereum.RegistryVersion_2_3: - return v.getUpkeepInfo23(opts, id) - } - - return nil, fmt.Errorf("keeper registry version %d is not supported", v.version) -} - -func (v *EthereumKeeperRegistry) getUpkeepInfo22(opts *bind.CallOpts, id *big.Int) (*UpkeepInfo, error) { - uk, err := v.registry2_2.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.PerformGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - LastPerformBlockNumber: uk.LastPerformedBlockNumber, - AmountSpent: uk.AmountSpent, - Paused: uk.Paused, - OffchainConfig: uk.OffchainConfig, - }, nil -} - -func (v *EthereumKeeperRegistry) getUpkeepInfo23(opts *bind.CallOpts, id *big.Int) (*UpkeepInfo, error) { - uk, err := v.registry2_3.GetUpkeep(opts, id) - if err != nil { - return nil, err - } - return &UpkeepInfo{ - Target: uk.Target.Hex(), - ExecuteGas: uk.PerformGas, - CheckData: uk.CheckData, - Balance: uk.Balance, - Admin: uk.Admin.Hex(), - MaxValidBlocknumber: uk.MaxValidBlocknumber, - LastPerformBlockNumber: uk.LastPerformedBlockNumber, - AmountSpent: uk.AmountSpent, - Paused: uk.Paused, - OffchainConfig: uk.OffchainConfig, - }, nil -} - -func (v *EthereumKeeperRegistry) GetKeeperInfo(ctx context.Context, keeperAddr string) (*KeeperInfo, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - var info struct { - Payee common.Address - Active bool - Balance *big.Int - } - var err error - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - info, err = v.registry1_1.GetKeeperInfo(opts, common.HexToAddress(keeperAddr)) - case ethereum.RegistryVersion_1_2: - info, err = v.registry1_2.GetKeeperInfo(opts, common.HexToAddress(keeperAddr)) - case ethereum.RegistryVersion_1_3: - info, err = v.registry1_3.GetKeeperInfo(opts, common.HexToAddress(keeperAddr)) - case ethereum.RegistryVersion_2_0, ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - // this is not used anywhere - return nil, errors.New("not supported") - } - - if err != nil { - return nil, err - } - return &KeeperInfo{ - Payee: info.Payee.Hex(), - Active: info.Active, - Balance: info.Balance, - }, nil -} - -func (v *EthereumKeeperRegistry) SetKeepers(keepers []string, payees []string, ocrConfig OCRv2Config) error { - opts := v.client.NewTXOpts() - var err error - - keepersAddresses := make([]common.Address, 0) - for _, k := range keepers { - keepersAddresses = append(keepersAddresses, common.HexToAddress(k)) - } - payeesAddresses := make([]common.Address, 0) - for _, p := range payees { - payeesAddresses = append(payeesAddresses, common.HexToAddress(p)) - } - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err = v.client.Decode(v.registry1_1.SetKeepers(opts, keepersAddresses, payeesAddresses)) - case ethereum.RegistryVersion_1_2: - _, err = v.client.Decode(v.registry1_2.SetKeepers(opts, keepersAddresses, payeesAddresses)) - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.SetKeepers(opts, keepersAddresses, payeesAddresses)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.SetConfig(opts, - ocrConfig.Signers, - ocrConfig.Transmitters, - ocrConfig.F, - ocrConfig.OnchainConfig, - ocrConfig.OffchainConfigVersion, - ocrConfig.OffchainConfig, - )) - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - return errors.New("not supported") - } - - return err -} - -// RegisterUpkeep registers contract to perform upkeep -func (v *EthereumKeeperRegistry) RegisterUpkeep(target string, gasLimit uint32, admin string, checkData []byte) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - _, err = v.client.Decode(v.registry1_1.RegisterUpkeep( - opts, - common.HexToAddress(target), - gasLimit, - common.HexToAddress(admin), - checkData, - )) - case ethereum.RegistryVersion_1_2: - _, err = v.client.Decode(v.registry1_2.RegisterUpkeep( - opts, - common.HexToAddress(target), - gasLimit, - common.HexToAddress(admin), - checkData, - )) - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.RegisterUpkeep( - opts, - common.HexToAddress(target), - gasLimit, - common.HexToAddress(admin), - checkData, - )) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.RegisterUpkeep( - opts, - common.HexToAddress(target), - gasLimit, - common.HexToAddress(admin), - checkData, - nil, // offchain config - )) - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - return errors.New("not supported") - } - - return err -} - -// CancelUpkeep cancels the given upkeep ID -func (v *EthereumKeeperRegistry) CancelUpkeep(id *big.Int) error { - opts := v.client.NewTXOpts() - var err error - var tx *seth.DecodedTransaction - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - tx, err = v.client.Decode(v.registry1_1.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_1_2: - tx, err = v.client.Decode(v.registry1_2.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_1_3: - tx, err = v.client.Decode(v.registry1_3.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_2_0: - tx, err = v.client.Decode(v.registry2_0.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_2_1: - tx, err = v.client.Decode(v.registry2_1.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_2_2: - tx, err = v.client.Decode(v.registry2_2.CancelUpkeep(opts, id)) - case ethereum.RegistryVersion_2_3: - tx, err = v.client.Decode(v.registry2_3.CancelUpkeep(opts, id)) - } - - txHash := "none" - if err == nil && tx != nil { - txHash = tx.Hash - } - - v.l.Info(). - Str("Upkeep ID", strconv.FormatInt(id.Int64(), 10)). - Str("From", v.client.MustGetRootKeyAddress().Hex()). - Str("TX Hash", txHash). - Msg("Cancel Upkeep tx") - - return err -} - -// SetUpkeepGasLimit sets the perform gas limit for a given upkeep ID -func (v *EthereumKeeperRegistry) SetUpkeepGasLimit(id *big.Int, gas uint32) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_2: - _, err = v.client.Decode(v.registry1_2.SetUpkeepGasLimit(opts, id, gas)) - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.SetUpkeepGasLimit(opts, id, gas)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.SetUpkeepGasLimit(opts, id, gas)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.SetUpkeepGasLimit(opts, id, gas)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.SetUpkeepGasLimit(opts, id, gas)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.SetUpkeepGasLimit(opts, id, gas)) - default: - return fmt.Errorf("keeper registry version %d is not supported for SetUpkeepGasLimit", v.version) - } - - return err -} - -// GetKeeperList get list of all registered keeper addresses -func (v *EthereumKeeperRegistry) GetKeeperList(ctx context.Context) ([]string, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - var list []common.Address - var err error - - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - list, err = v.registry1_1.GetKeeperList(opts) - case ethereum.RegistryVersion_1_2: - state, err := v.registry1_2.GetState(opts) - if err != nil { - return []string{}, err - } - list = state.Keepers - case ethereum.RegistryVersion_1_3: - state, err := v.registry1_3.GetState(opts) - if err != nil { - return []string{}, err - } - list = state.Keepers - case ethereum.RegistryVersion_2_0: - state, err := v.registry2_0.GetState(opts) - if err != nil { - return []string{}, err - } - list = state.Transmitters - case ethereum.RegistryVersion_2_1, ethereum.RegistryVersion_2_2, ethereum.RegistryVersion_2_3: - return nil, errors.New("not supported") - } - - if err != nil { - return []string{}, err - } - addrs := make([]string, 0) - for _, ca := range list { - addrs = append(addrs, ca.Hex()) - } - return addrs, nil -} - -// UpdateCheckData updates the check data of an upkeep -func (v *EthereumKeeperRegistry) UpdateCheckData(id *big.Int, newCheckData []byte) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.UpdateCheckData(opts, id, newCheckData)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.UpdateCheckData(opts, id, newCheckData)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.SetUpkeepCheckData(opts, id, newCheckData)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.SetUpkeepCheckData(opts, id, newCheckData)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.SetUpkeepCheckData(opts, id, newCheckData)) - default: - return fmt.Errorf("UpdateCheckData is not supported by keeper registry version %d", v.version) - } - - return err -} - -// SetUpkeepTriggerConfig updates the trigger config of an upkeep (only for version 2.1) -func (v *EthereumKeeperRegistry) SetUpkeepTriggerConfig(id *big.Int, triggerConfig []byte) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.SetUpkeepTriggerConfig(opts, id, triggerConfig)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.SetUpkeepTriggerConfig(opts, id, triggerConfig)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.SetUpkeepTriggerConfig(opts, id, triggerConfig)) - default: - return fmt.Errorf("SetUpkeepTriggerConfig is not supported by keeper registry version %d", v.version) - } - - return err -} - -// SetUpkeepPrivilegeConfig sets the privilege config of an upkeep (only for version 2.1) -func (v *EthereumKeeperRegistry) SetUpkeepPrivilegeConfig(id *big.Int, privilegeConfig []byte) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.SetUpkeepPrivilegeConfig(opts, id, privilegeConfig)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.SetUpkeepPrivilegeConfig(opts, id, privilegeConfig)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.SetUpkeepPrivilegeConfig(opts, id, privilegeConfig)) - default: - return fmt.Errorf("SetUpkeepPrivilegeConfig is not supported by keeper registry version %d", v.version) - } - - return err -} - -// PauseUpkeep stops an upkeep from an upkeep -func (v *EthereumKeeperRegistry) PauseUpkeep(id *big.Int) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.PauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.PauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.PauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.PauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.PauseUpkeep(opts, id)) - default: - return fmt.Errorf("PauseUpkeep is not supported by keeper registry version %d", v.version) - } - - return err -} - -// UnpauseUpkeep get list of all registered keeper addresses -func (v *EthereumKeeperRegistry) UnpauseUpkeep(id *big.Int) error { - opts := v.client.NewTXOpts() - var err error - - switch v.version { - case ethereum.RegistryVersion_1_3: - _, err = v.client.Decode(v.registry1_3.UnpauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_0: - _, err = v.client.Decode(v.registry2_0.UnpauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_1: - _, err = v.client.Decode(v.registry2_1.UnpauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_2: - _, err = v.client.Decode(v.registry2_2.UnpauseUpkeep(opts, id)) - case ethereum.RegistryVersion_2_3: - _, err = v.client.Decode(v.registry2_3.UnpauseUpkeep(opts, id)) - default: - return fmt.Errorf("UnpauseUpkeep is not supported by keeper registry version %d", v.version) - } - - return err -} - -// Parses upkeep performed log -func (v *EthereumKeeperRegistry) ParseUpkeepPerformedLog(log *types.Log) (*UpkeepPerformedLog, error) { - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - parsedLog, err := v.registry1_1.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: parsedLog.From, - }, nil - case ethereum.RegistryVersion_1_2: - parsedLog, err := v.registry1_2.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: parsedLog.From, - }, nil - case ethereum.RegistryVersion_1_3: - parsedLog, err := v.registry1_3.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: parsedLog.From, - }, nil - case ethereum.RegistryVersion_2_0: - parsedLog, err := v.registry2_0.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: utils.ZeroAddress, - }, nil - case ethereum.RegistryVersion_2_1: - parsedLog, err := v.registry2_1.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: utils.ZeroAddress, - }, nil - case ethereum.RegistryVersion_2_2: - parsedLog, err := v.registry2_2.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: utils.ZeroAddress, - }, nil - case ethereum.RegistryVersion_2_3: - parsedLog, err := v.registry2_3.ParseUpkeepPerformed(*log) - if err != nil { - return nil, err - } - return &UpkeepPerformedLog{ - Id: parsedLog.Id, - Success: parsedLog.Success, - From: utils.ZeroAddress, - }, nil - } - return nil, fmt.Errorf("keeper registry version %d is not supported", v.version) -} - -// ParseStaleUpkeepReportLog Parses Stale upkeep report log -func (v *EthereumKeeperRegistry) ParseStaleUpkeepReportLog(log *types.Log) (*StaleUpkeepReportLog, error) { - //nolint:exhaustive - switch v.version { - case ethereum.RegistryVersion_2_0: - parsedLog, err := v.registry2_0.ParseStaleUpkeepReport(*log) - if err != nil { - return nil, err - } - return &StaleUpkeepReportLog{ - Id: parsedLog.Id, - }, nil - case ethereum.RegistryVersion_2_1: - parsedLog, err := v.registry2_1.ParseStaleUpkeepReport(*log) - if err != nil { - return nil, err - } - return &StaleUpkeepReportLog{ - Id: parsedLog.Id, - }, nil - case ethereum.RegistryVersion_2_2: - parsedLog, err := v.registry2_2.ParseStaleUpkeepReport(*log) - if err != nil { - return nil, err - } - return &StaleUpkeepReportLog{ - Id: parsedLog.Id, - }, nil - case ethereum.RegistryVersion_2_3: - parsedLog, err := v.registry2_3.ParseStaleUpkeepReport(*log) - if err != nil { - return nil, err - } - return &StaleUpkeepReportLog{ - Id: parsedLog.Id, - }, nil - } - return nil, fmt.Errorf("keeper registry version %d is not supported", v.version) -} - -// Parses the upkeep ID from an 'UpkeepRegistered' log, returns error on any other log -func (v *EthereumKeeperRegistry) ParseUpkeepIdFromRegisteredLog(log *types.Log) (*big.Int, error) { - switch v.version { - case ethereum.RegistryVersion_1_0, ethereum.RegistryVersion_1_1: - parsedLog, err := v.registry1_1.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_1_2: - parsedLog, err := v.registry1_2.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_1_3: - parsedLog, err := v.registry1_3.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_2_0: - parsedLog, err := v.registry2_0.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_2_1: - parsedLog, err := v.registry2_1.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_2_2: - parsedLog, err := v.registry2_2.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - case ethereum.RegistryVersion_2_3: - parsedLog, err := v.registry2_3.ParseUpkeepRegistered(*log) - if err != nil { - return nil, err - } - return parsedLog.Id, nil - } - - return nil, fmt.Errorf("keeper registry version %d is not supported", v.version) -} - -func DeployKeeperRegistry( - client *seth.Client, - opts *KeeperRegistryOpts, -) (KeeperRegistry, error) { - var mode uint8 - switch client.ChainID { - // Arbitrum payment model - case networks.ArbitrumMainnet.ChainID, networks.ArbitrumSepolia.ChainID: - mode = uint8(1) - // Optimism payment model - case networks.OptimismMainnet.ChainID, networks.OptimismSepolia.ChainID: - mode = uint8(2) - // Base - case networks.BaseMainnet.ChainID, networks.BaseSepolia.ChainID: - mode = uint8(2) - default: - mode = uint8(0) - } - registryGasOverhead := big.NewInt(80000) - switch opts.RegistryVersion { - case eth_contracts.RegistryVersion_1_0, eth_contracts.RegistryVersion_1_1: - return deployRegistry10_11(client, opts) - case eth_contracts.RegistryVersion_1_2: - return deployRegistry12(client, opts) - case eth_contracts.RegistryVersion_1_3: - return deployRegistry13(client, opts, mode, registryGasOverhead) - case eth_contracts.RegistryVersion_2_0: - return deployRegistry20(client, opts, mode) - case eth_contracts.RegistryVersion_2_1: - return deployRegistry21(client, opts, mode) - case eth_contracts.RegistryVersion_2_2: - return deployRegistry22(client, opts) - case eth_contracts.RegistryVersion_2_3: - return deployRegistry23(client, opts) - default: - return nil, fmt.Errorf("keeper registry version %d is not supported", opts.RegistryVersion) - } -} - -func deployRegistry10_11(client *seth.Client, opts *KeeperRegistryOpts) (KeeperRegistry, error) { - abi, err := keeper_registry_wrapper1_1.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_1 ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry1_1", *abi, common.FromHex(keeper_registry_wrapper1_1.KeeperRegistryMetaData.Bin), - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - opts.Settings.PaymentPremiumPPB, - opts.Settings.FlatFeeMicroLINK, - opts.Settings.BlockCountPerTurn, - opts.Settings.CheckGasLimit, - opts.Settings.StalenessSeconds, - opts.Settings.GasCeilingMultiplier, - opts.Settings.FallbackGasPrice, - opts.Settings.FallbackLinkPrice, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistry1_1 instance deployment have failed: %w", err) - } - - instance, err := keeper_registry_wrapper1_1.NewKeeperRegistry(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_1 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_1_1, - registry1_1: instance, - registry1_2: nil, - registry1_3: nil, - address: &data.Address, - }, err -} - -func deployRegistry12(client *seth.Client, opts *KeeperRegistryOpts) (KeeperRegistry, error) { - abi, err := keeper_registry_wrapper1_2.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_2 ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry1_2", *abi, common.FromHex(keeper_registry_wrapper1_2.KeeperRegistryMetaData.Bin), - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - keeper_registry_wrapper1_2.Config{ - PaymentPremiumPPB: opts.Settings.PaymentPremiumPPB, - FlatFeeMicroLink: opts.Settings.FlatFeeMicroLINK, - BlockCountPerTurn: opts.Settings.BlockCountPerTurn, - CheckGasLimit: opts.Settings.CheckGasLimit, - StalenessSeconds: opts.Settings.StalenessSeconds, - GasCeilingMultiplier: opts.Settings.GasCeilingMultiplier, - MinUpkeepSpend: opts.Settings.MinUpkeepSpend, - MaxPerformGas: opts.Settings.MaxPerformGas, - FallbackGasPrice: opts.Settings.FallbackGasPrice, - FallbackLinkPrice: opts.Settings.FallbackLinkPrice, - Transcoder: common.HexToAddress(opts.TranscoderAddr), - Registrar: common.HexToAddress(opts.RegistrarAddr), - }, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistry1_2 instance deployment have failed: %w", err) - } - - instance, err := keeper_registry_wrapper1_2.NewKeeperRegistry(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_2 instance: %w", err) - } - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_1_2, - registry1_1: nil, - registry1_2: instance, - registry1_3: nil, - address: &data.Address, - }, err -} - -func deployRegistry13(client *seth.Client, opts *KeeperRegistryOpts, mode uint8, registryGasOverhead *big.Int) (KeeperRegistry, error) { - logicAbi, err := keeper_registry_logic1_3.KeeperRegistryLogicMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistryLogic1_3 ABI: %w", err) - } - logicData, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistryLogic1_3", *logicAbi, common.FromHex(keeper_registry_logic1_3.KeeperRegistryLogicMetaData.Bin), - mode, // Default payment model - registryGasOverhead, // Registry gas overhead - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistryLogic1_3 instance deployment have failed: %w", err) - } - - abi, err := keeper_registry_wrapper1_3.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_3 ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry1_3", *abi, common.FromHex(keeper_registry_wrapper1_3.KeeperRegistryMetaData.Bin), - logicData.Address, - keeper_registry_wrapper1_3.Config{ - PaymentPremiumPPB: opts.Settings.PaymentPremiumPPB, - FlatFeeMicroLink: opts.Settings.FlatFeeMicroLINK, - BlockCountPerTurn: opts.Settings.BlockCountPerTurn, - CheckGasLimit: opts.Settings.CheckGasLimit, - StalenessSeconds: opts.Settings.StalenessSeconds, - GasCeilingMultiplier: opts.Settings.GasCeilingMultiplier, - MinUpkeepSpend: opts.Settings.MinUpkeepSpend, - MaxPerformGas: opts.Settings.MaxPerformGas, - FallbackGasPrice: opts.Settings.FallbackGasPrice, - FallbackLinkPrice: opts.Settings.FallbackLinkPrice, - Transcoder: common.HexToAddress(opts.TranscoderAddr), - Registrar: common.HexToAddress(opts.RegistrarAddr), - }, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistry1_3 instance deployment have failed: %w", err) - } - - instance, err := keeper_registry_wrapper1_3.NewKeeperRegistry(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_3 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_1_3, - registry1_1: nil, - registry1_2: nil, - registry1_3: instance, - address: &data.Address, - }, err -} - -func deployRegistry20(client *seth.Client, opts *KeeperRegistryOpts, mode uint8) (KeeperRegistry, error) { - logicAbi, err := keeper_registry_logic2_0.KeeperRegistryLogicMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistryLogic2_0 ABI: %w", err) - } - logicData, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistryLogic2_0", *logicAbi, common.FromHex(keeper_registry_logic2_0.KeeperRegistryLogicMetaData.Bin), - mode, // Default payment model - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistryLogic2_0 instance deployment have failed: %w", err) - } - - abi, err := keeper_registry_wrapper2_0.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_3 ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry2_0", *abi, common.FromHex(keeper_registry_wrapper2_0.KeeperRegistryMetaData.Bin), - logicData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistry2_0 instance deployment have failed: %w", err) - } - - instance, err := keeper_registry_wrapper2_0.NewKeeperRegistry(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry2_0 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_2_0, - registry2_0: instance, - address: &data.Address, - }, err -} - -func deployRegistry21(client *seth.Client, opts *KeeperRegistryOpts, mode uint8) (KeeperRegistry, error) { - automationForwarderLogicAddr, err := deployAutomationForwarderLogicSeth(client) - if err != nil { - return nil, err - } - - logicBAbi, err := registrylogicb21.KeeperRegistryLogicBMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistryLogicB2_1 ABI: %w", err) - } - logicBData, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistryLogicB2_1", *logicBAbi, common.FromHex(registrylogicb21.KeeperRegistryLogicBMetaData.Bin), - mode, - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - automationForwarderLogicAddr, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistryLogicB2_1 instance deployment have failed: %w", err) - } - - logicAAbi, err := registrylogica21.KeeperRegistryLogicAMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistryLogicA2_1 ABI: %w", err) - } - logicAData, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistryLogicA2_1", *logicAAbi, common.FromHex(registrylogica21.KeeperRegistryLogicAMetaData.Bin), - logicBData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistryLogicA2_1 instance deployment have failed: %w", err) - } - - abi, err := registry21.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry2_1 ABI: %w", err) - } - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistry2_1", *abi, common.FromHex(registry21.KeeperRegistryMetaData.Bin), - logicAData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("KeeperRegistry2_1 instance deployment have failed: %w", err) - } - - instance, err := iregistry21.NewIKeeperRegistryMaster(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry2_1 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_2_1, - registry2_1: instance, - address: &data.Address, - }, err -} - -func deployRegistry22(client *seth.Client, opts *KeeperRegistryOpts) (KeeperRegistry, error) { - var chainModuleAddr common.Address - var err error - chainId := client.ChainID - - switch chainId { - case networks.ScrollMainnet.ChainID, networks.ScrollSepolia.ChainID: - chainModuleAddr, err = deployScrollModule(client) - case networks.ArbitrumMainnet.ChainID, networks.ArbitrumSepolia.ChainID: - chainModuleAddr, err = deployArbitrumModule(client) - case networks.OptimismMainnet.ChainID, networks.OptimismSepolia.ChainID: - chainModuleAddr, err = deployOptimismModule(client) - default: - chainModuleAddr, err = deployBaseModule(client) - } - if err != nil { - return nil, err - } - - automationForwarderLogicAddr, err := deployAutomationForwarderLogicSeth(client) - if err != nil { - return nil, err - } - - allowedReadOnlyAddress := common.HexToAddress("0x0000000000000000000000000000000000000000") - - logicBAbi, err := registrylogicb22.AutomationRegistryLogicBMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistryLogicB2_2 ABI: %w", err) - } - - logicBData, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistryLogicB2_2", *logicBAbi, common.FromHex(registrylogicb22.AutomationRegistryLogicBMetaData.Bin), - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.ETHFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - automationForwarderLogicAddr, - allowedReadOnlyAddress, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistryLogicB2_2 instance deployment have failed: %w", err) - } - - logicAAbi, err := registrylogica22.AutomationRegistryLogicAMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistryLogicA2_2 ABI: %w", err) - } - logicAData, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistryLogicA2_2", *logicAAbi, common.FromHex(registrylogica22.AutomationRegistryLogicAMetaData.Bin), - logicBData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistryLogicA2_2 instance deployment have failed: %w", err) - } - - abi, err := registry22.AutomationRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistry2_2 ABI: %w", err) - } - - data, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistry2_2", *abi, common.FromHex(registry22.AutomationRegistryMetaData.Bin), - logicAData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistry2_2 instance deployment have failed: %w", err) - } - - instance, err := iregistry22.NewIAutomationRegistryMaster(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate AutomationRegistry2_2 instance: %w", err) - } - - chainModule, err := i_chain_module.NewIChainModule( - chainModuleAddr, - wrappers.MustNewWrappedContractBackend(nil, client), - ) - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_2_2, - registry2_2: instance, - chainModule: chainModule, - address: &data.Address, - }, err -} - -func deployRegistry23(client *seth.Client, opts *KeeperRegistryOpts) (KeeperRegistry, error) { - var chainModuleAddr common.Address - var err error - chainId := client.ChainID - - switch chainId { - case networks.ScrollMainnet.ChainID, networks.ScrollSepolia.ChainID: - chainModuleAddr, err = deployScrollModule(client) - case networks.ArbitrumMainnet.ChainID, networks.ArbitrumSepolia.ChainID: - chainModuleAddr, err = deployArbitrumModule(client) - case networks.OptimismMainnet.ChainID, networks.OptimismSepolia.ChainID: - chainModuleAddr, err = deployOptimismModule(client) - default: - chainModuleAddr, err = deployBaseModule(client) - } - if err != nil { - return nil, err - } - - automationForwarderLogicAddr, err := deployAutomationForwarderLogicSeth(client) - if err != nil { - return nil, err - } - - allowedReadOnlyAddress := common.HexToAddress("0x0000000000000000000000000000000000000000") - - logicCAbi, err := registrylogicc23.AutomationRegistryLogicCMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistryLogicC2_3 ABI: %w", err) - } - - logicCData, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistryLogicC2_3", *logicCAbi, common.FromHex(registrylogicc23.AutomationRegistryLogicCMetaData.Bin), - common.HexToAddress(opts.LinkAddr), - common.HexToAddress(opts.LinkUSDFeedAddr), - common.HexToAddress(opts.NativeUSDFeedAddr), - common.HexToAddress(opts.GasFeedAddr), - automationForwarderLogicAddr, - allowedReadOnlyAddress, - uint8(0), // onchain payout mode - common.HexToAddress(opts.WrappedNativeAddr), - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistryLogicC2_3 instance deployment have failed: %w", err) - } - - logicBAbi, err := registrylogicb23.AutomationRegistryLogicBMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistryLogicB2_3 ABI: %w", err) - } - - logicBData, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistryLogicB2_3", *logicBAbi, common.FromHex(registrylogicb23.AutomationRegistryLogicBMetaData.Bin), - logicCData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistryLogicB2_3 instance deployment have failed: %w", err) - } - - logicAAbi, err := registrylogica23.AutomationRegistryLogicAMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistryLogicA2_3 ABI: %w", err) - } - logicAData, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistryLogicA2_3", *logicAAbi, common.FromHex(registrylogica23.AutomationRegistryLogicAMetaData.Bin), - logicBData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistryLogicA2_3 instance deployment have failed: %w", err) - } - - abi, err := registry23.AutomationRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistry2_3 ABI: %w", err) - } - - data, err := client.DeployContract(client.NewTXOpts(), "AutomationRegistry2_3", *abi, common.FromHex(registry23.AutomationRegistryMetaData.Bin), - logicAData.Address, - ) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("AutomationRegistry2_3 instance deployment have failed: %w", err) - } - - instance, err := iregistry23.NewIAutomationRegistryMaster23(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate AutomationRegistry2_3 instance: %w", err) - } - - chainModule, err := i_chain_module.NewIChainModule( - chainModuleAddr, - wrappers.MustNewWrappedContractBackend(nil, client), - ) - - return &EthereumKeeperRegistry{ - client: client, - version: eth_contracts.RegistryVersion_2_3, - registry2_3: instance, - chainModule: chainModule, - address: &data.Address, - }, err -} - -// LoadKeeperRegistry returns deployed on given address EthereumKeeperRegistry -func LoadKeeperRegistry(l zerolog.Logger, client *seth.Client, address common.Address, registryVersion eth_contracts.KeeperRegistryVersion, chainModuleAddress common.Address) (KeeperRegistry, error) { - var keeper *EthereumKeeperRegistry - var err error - switch registryVersion { - case eth_contracts.RegistryVersion_1_1: - keeper, err = loadRegistry1_1(client, address) - case eth_contracts.RegistryVersion_1_2: - keeper, err = loadRegistry1_2(client, address) - case eth_contracts.RegistryVersion_1_3: - keeper, err = loadRegistry1_3(client, address) - case eth_contracts.RegistryVersion_2_0: - keeper, err = loadRegistry2_0(client, address) - case eth_contracts.RegistryVersion_2_1: - keeper, err = loadRegistry2_1(client, address) - case eth_contracts.RegistryVersion_2_2: // why the contract name is not the same as the actual contract name? - keeper, err = loadRegistry2_2(client, address) - case eth_contracts.RegistryVersion_2_3: - keeper, err = loadRegistry2_3(client, address, chainModuleAddress) - default: - return nil, fmt.Errorf("keeper registry version %d is not supported", registryVersion) - } - - if keeper != nil { - keeper.version = registryVersion - keeper.l = l - } - return keeper, err -} - -func loadRegistry1_1(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := keeper_registry_wrapper1_1.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_1 ABI: %w", err) - } - - client.ContractStore.AddABI("KeeperRegistry1_1", *abi) - client.ContractStore.AddBIN("KeeperRegistry1_1", common.FromHex(keeper_registry_wrapper1_1.KeeperRegistryMetaData.Bin)) - - instance, err := keeper_registry_wrapper1_1.NewKeeperRegistry(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_1 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry1_1: instance, - }, nil -} - -func loadRegistry1_2(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := keeper_registry_wrapper1_2.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_2 ABI: %w", err) - } - - client.ContractStore.AddABI("KeeperRegistry1_2", *abi) - client.ContractStore.AddBIN("KeeperRegistry1_2", common.FromHex(keeper_registry_wrapper1_2.KeeperRegistryMetaData.Bin)) - - instance, err := keeper_registry_wrapper1_2.NewKeeperRegistry(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_2 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry1_2: instance, - }, nil -} - -func loadRegistry1_3(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := keeper_registry_wrapper1_3.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry1_3 ABI: %w", err) - } - - client.ContractStore.AddABI("KeeperRegistry1_3", *abi) - client.ContractStore.AddBIN("KeeperRegistry1_3", common.FromHex(keeper_registry_wrapper1_3.KeeperRegistryMetaData.Bin)) - - instance, err := keeper_registry_wrapper1_3.NewKeeperRegistry(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry1_3 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry1_3: instance, - }, nil -} - -func loadRegistry2_0(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := keeper_registry_wrapper2_0.KeeperRegistryMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry2_0 ABI: %w", err) - } - - client.ContractStore.AddABI("KeeperRegistry2_0", *abi) - client.ContractStore.AddBIN("KeeperRegistry2_0", common.FromHex(keeper_registry_wrapper2_0.KeeperRegistryMetaData.Bin)) - - instance, err := keeper_registry_wrapper2_0.NewKeeperRegistry(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry2_0 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry2_0: instance, - }, nil -} - -func loadRegistry2_1(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := iregistry21.IKeeperRegistryMasterMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get KeeperRegistry2_1 ABI: %w", err) - } - - client.ContractStore.AddABI("KeeperRegistry2_1", *abi) - client.ContractStore.AddBIN("KeeperRegistry2_1", common.FromHex(iregistry21.IKeeperRegistryMasterMetaData.Bin)) - - instance, err := iregistry21.NewIKeeperRegistryMaster(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate KeeperRegistry2_1 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry2_1: instance, - }, nil -} - -func loadRegistry2_2(client *seth.Client, address common.Address) (*EthereumKeeperRegistry, error) { - abi, err := iregistry22.IAutomationRegistryMasterMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to get AutomationRegistry2_2 ABI: %w", err) - } - - client.ContractStore.AddABI("AutomationRegistry2_2", *abi) - client.ContractStore.AddBIN("AutomationRegistry2_2", common.FromHex(iregistry22.IAutomationRegistryMasterMetaData.Bin)) - - instance, err := iregistry22.NewIAutomationRegistryMaster(address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to instantiate AutomationRegistry2_2 instance: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry2_2: instance, - }, nil -} - -func loadRegistry2_3(client *seth.Client, address, chainModuleAddress common.Address) (*EthereumKeeperRegistry, error) { - loader := seth.NewContractLoader[iregistry23.IAutomationRegistryMaster23](client) - instance, err := loader.LoadContract("AutomationRegistry2_3", address, iregistry23.IAutomationRegistryMaster23MetaData.GetAbi, iregistry23.NewIAutomationRegistryMaster23) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to load AutomationRegistry2_3 instance: %w", err) - } - - chainModule, err := loadChainModule(client, chainModuleAddress) - if err != nil { - return &EthereumKeeperRegistry{}, fmt.Errorf("failed to load chain module: %w", err) - } - - return &EthereumKeeperRegistry{ - address: &address, - client: client, - registry2_3: instance, - chainModule: chainModule, - }, nil -} - -func deployAutomationForwarderLogicSeth(client *seth.Client) (common.Address, error) { - abi, err := automationForwarderLogic.AutomationForwarderLogicMetaData.GetAbi() - if err != nil { - return common.Address{}, fmt.Errorf("failed to get AutomationForwarderLogic ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "AutomationForwarderLogic", *abi, common.FromHex(automationForwarderLogic.AutomationForwarderLogicMetaData.Bin)) - if err != nil { - return common.Address{}, fmt.Errorf("AutomationForwarderLogic instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -func deployScrollModule(client *seth.Client) (common.Address, error) { - abi, err := scroll_module.ScrollModuleMetaData.GetAbi() - if err != nil { - return common.Address{}, fmt.Errorf("failed to get ScrollModule ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "ScrollModule", *abi, common.FromHex(scroll_module.ScrollModuleMetaData.Bin)) - if err != nil { - return common.Address{}, fmt.Errorf("ScrollModule instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -func deployArbitrumModule(client *seth.Client) (common.Address, error) { - abi, err := arbitrum_module.ArbitrumModuleMetaData.GetAbi() - if err != nil { - return common.Address{}, fmt.Errorf("failed to get ArbitrumModule ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "ArbitrumModule", *abi, common.FromHex(arbitrum_module.ArbitrumModuleMetaData.Bin)) - if err != nil { - return common.Address{}, fmt.Errorf("ArbitrumModule instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -func deployOptimismModule(client *seth.Client) (common.Address, error) { - abi, err := optimism_module.OptimismModuleMetaData.GetAbi() - if err != nil { - return common.Address{}, fmt.Errorf("failed to get OptimismModule ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "OptimismModule", *abi, common.FromHex(optimism_module.OptimismModuleMetaData.Bin)) - if err != nil { - return common.Address{}, fmt.Errorf("OptimismModule instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -func loadChainModule(client *seth.Client, address common.Address) (*i_chain_module.IChainModule, error) { - abi, err := i_chain_module.IChainModuleMetaData.GetAbi() - if err != nil { - return &i_chain_module.IChainModule{}, fmt.Errorf("failed to get IChainModule ABI: %w", err) - } - - client.ContractStore.AddABI("IChainModule", *abi) - client.ContractStore.AddBIN("IChainModule", common.FromHex(i_chain_module.IChainModuleMetaData.Bin)) - - chainModule, err := i_chain_module.NewIChainModule( - address, - wrappers.MustNewWrappedContractBackend(nil, client), - ) - if err != nil { - return &i_chain_module.IChainModule{}, fmt.Errorf("failed to instantiate IChainModule instance: %w", err) - } - - return chainModule, nil -} - -func deployBaseModule(client *seth.Client) (common.Address, error) { - abi, err := chain_module_base.ChainModuleBaseMetaData.GetAbi() - if err != nil { - return common.Address{}, fmt.Errorf("failed to get BaseModule ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "BaseModule", *abi, common.FromHex(chain_module_base.ChainModuleBaseMetaData.Bin)) - if err != nil { - return common.Address{}, fmt.Errorf("BaseModule instance deployment have failed: %w", err) - } - - return data.Address, nil -} - -// EthereumKeeperRegistrar corresponds to the registrar which is used to send requests to the registry when -// registering new upkeeps. -type EthereumKeeperRegistrar struct { - client *seth.Client - registrar *keeper_registrar_wrapper1_2.KeeperRegistrar - registrar20 *keeper_registrar_wrapper2_0.KeeperRegistrar - registrar21 *registrar21.AutomationRegistrar - registrar23 *registrar23.AutomationRegistrar - address *common.Address -} - -func (v *EthereumKeeperRegistrar) Address() string { - return v.address.Hex() -} - -func (v *EthereumKeeperRegistrar) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} - -// register Upkeep with native token, only available from v2.3 -func (v *EthereumKeeperRegistrar) RegisterUpkeepFromKey(keyNum int, name string, email []byte, upkeepAddr string, gasLimit uint32, adminAddr string, checkData []byte, amount *big.Int, wethTokenAddr string, isLogTrigger bool, isMercury bool) (*types.Transaction, error) { - if v.registrar23 == nil { - return nil, errors.New("RegisterUpkeepFromKey with native token is only supported in registrar version v2.3") - } - - registrarABI = cltypes.MustGetABI(registrar23.AutomationRegistrarABI) - txOpts := v.client.NewTXKeyOpts(keyNum, seth.WithValue(amount)) - - if isLogTrigger { - var topic0InBytes [32]byte - // bytes representation of 0x0000000000000000000000000000000000000000000000000000000000000000 - bytes0 := [32]byte{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - } - if isMercury { - // bytes representation of 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd - topic0InBytes = [32]byte{209, 255, 233, 228, 85, 129, 193, 29, 125, 159, 46, 213, 247, 82, 23, 205, 75, 233, 248, 183, 238, 230, 175, 15, 109, 3, 244, 109, 229, 57, 86, 205} - } else { - // bytes representation of 0x3d53a39550e04688065827f3bb86584cb007ab9ebca7ebd528e7301c9c31eb5d - topic0InBytes = [32]byte{ - 61, 83, 163, 149, 80, 224, 70, 136, - 6, 88, 39, 243, 187, 134, 88, 76, - 176, 7, 171, 158, 188, 167, 235, - 213, 40, 231, 48, 28, 156, 49, 235, 93, - } - } - - logTriggerConfigStruct := acutils.IAutomationV21PlusCommonLogTriggerConfig{ - ContractAddress: common.HexToAddress(upkeepAddr), - FilterSelector: 0, - Topic0: topic0InBytes, - Topic1: bytes0, - Topic2: bytes0, - Topic3: bytes0, - } - encodedLogTriggerConfig, err := compatibleUtils.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) - if err != nil { - return nil, err - } - - params := registrar23.AutomationRegistrar23RegistrationParams{ - UpkeepContract: common.HexToAddress(upkeepAddr), - Amount: amount, - AdminAddress: common.HexToAddress(adminAddr), - GasLimit: gasLimit, - TriggerType: uint8(1), // trigger type - BillingToken: common.HexToAddress(wethTokenAddr), // native - Name: name, - EncryptedEmail: email, - CheckData: checkData, - TriggerConfig: encodedLogTriggerConfig, // log trigger upkeep - OffchainConfig: []byte{}, - } - - decodedTx, err := v.client.Decode(v.registrar23.RegisterUpkeep(txOpts, - params, - )) - return decodedTx.Transaction, err - } - - params := registrar23.AutomationRegistrar23RegistrationParams{ - UpkeepContract: common.HexToAddress(upkeepAddr), - Amount: amount, - AdminAddress: common.HexToAddress(adminAddr), - GasLimit: gasLimit, - TriggerType: uint8(0), // trigger type - BillingToken: common.HexToAddress(wethTokenAddr), // native - Name: name, - EncryptedEmail: email, - CheckData: checkData, - TriggerConfig: []byte{}, // conditional upkeep - OffchainConfig: []byte{}, - } - - decodedTx, err := v.client.Decode(v.registrar23.RegisterUpkeep(txOpts, - params, - )) - return decodedTx.Transaction, err -} - -// EncodeRegisterRequest encodes register request to call it through link token TransferAndCall -func (v *EthereumKeeperRegistrar) EncodeRegisterRequest(name string, email []byte, upkeepAddr string, gasLimit uint32, adminAddr string, checkData []byte, amount *big.Int, source uint8, senderAddr string, isLogTrigger bool, isMercury bool, linkTokenAddr string) ([]byte, error) { - if v.registrar20 != nil { - registryABI, err := abi.JSON(strings.NewReader(keeper_registrar_wrapper2_0.KeeperRegistrarMetaData.ABI)) - if err != nil { - return nil, err - } - req, err := registryABI.Pack( - "register", - name, - email, - common.HexToAddress(upkeepAddr), - gasLimit, - common.HexToAddress(adminAddr), - checkData, - []byte{}, // offchainConfig - amount, - common.HexToAddress(senderAddr), - ) - - if err != nil { - return nil, err - } - return req, nil - } else if v.registrar21 != nil { - if isLogTrigger { - var topic0InBytes [32]byte - // bytes representation of 0x0000000000000000000000000000000000000000000000000000000000000000 - bytes0 := [32]byte{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - } - if isMercury { - // bytes representation of 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd - topic0InBytes = [32]byte{209, 255, 233, 228, 85, 129, 193, 29, 125, 159, 46, 213, 247, 82, 23, 205, 75, 233, 248, 183, 238, 230, 175, 15, 109, 3, 244, 109, 229, 57, 86, 205} - } else { - // bytes representation of 0x3d53a39550e04688065827f3bb86584cb007ab9ebca7ebd528e7301c9c31eb5d - topic0InBytes = [32]byte{ - 61, 83, 163, 149, 80, 224, 70, 136, - 6, 88, 39, 243, 187, 134, 88, 76, - 176, 7, 171, 158, 188, 167, 235, - 213, 40, 231, 48, 28, 156, 49, 235, 93, - } - } - - logTriggerConfigStruct := acutils.IAutomationV21PlusCommonLogTriggerConfig{ - ContractAddress: common.HexToAddress(upkeepAddr), - FilterSelector: 0, - Topic0: topic0InBytes, - Topic1: bytes0, - Topic2: bytes0, - Topic3: bytes0, - } - encodedLogTriggerConfig, err := compatibleUtils.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) - if err != nil { - return nil, err - } - - req, err := registrarABI.Pack( - "register", - name, - email, - common.HexToAddress(upkeepAddr), - gasLimit, - common.HexToAddress(adminAddr), - uint8(1), // trigger type - checkData, - encodedLogTriggerConfig, // triggerConfig - []byte{}, // offchainConfig - amount, - common.HexToAddress(senderAddr), - ) - - return req, err - } - req, err := registrarABI.Pack( - "register", - name, - email, - common.HexToAddress(upkeepAddr), - gasLimit, - common.HexToAddress(adminAddr), - uint8(0), // trigger type - checkData, - []byte{}, // triggerConfig - []byte{}, // offchainConfig - amount, - common.HexToAddress(senderAddr), - ) - return req, err - } else if v.registrar23 != nil { - registrarABI = cltypes.MustGetABI(registrar23.AutomationRegistrarABI) - - if isLogTrigger { - var topic0InBytes [32]byte - // bytes representation of 0x0000000000000000000000000000000000000000000000000000000000000000 - bytes0 := [32]byte{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - } - if isMercury { - // bytes representation of 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd - topic0InBytes = [32]byte{209, 255, 233, 228, 85, 129, 193, 29, 125, 159, 46, 213, 247, 82, 23, 205, 75, 233, 248, 183, 238, 230, 175, 15, 109, 3, 244, 109, 229, 57, 86, 205} - } else { - // bytes representation of 0x3d53a39550e04688065827f3bb86584cb007ab9ebca7ebd528e7301c9c31eb5d - topic0InBytes = [32]byte{ - 61, 83, 163, 149, 80, 224, 70, 136, - 6, 88, 39, 243, 187, 134, 88, 76, - 176, 7, 171, 158, 188, 167, 235, - 213, 40, 231, 48, 28, 156, 49, 235, 93, - } - } - - logTriggerConfigStruct := acutils.IAutomationV21PlusCommonLogTriggerConfig{ - ContractAddress: common.HexToAddress(upkeepAddr), - FilterSelector: 0, - Topic0: topic0InBytes, - Topic1: bytes0, - Topic2: bytes0, - Topic3: bytes0, - } - encodedLogTriggerConfig, err := compatibleUtils.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) - if err != nil { - return nil, err - } - - params := registrar23.AutomationRegistrar23RegistrationParams{ - UpkeepContract: common.HexToAddress(upkeepAddr), - Amount: amount, - AdminAddress: common.HexToAddress(adminAddr), - GasLimit: gasLimit, - TriggerType: uint8(1), // trigger type - BillingToken: common.HexToAddress(linkTokenAddr), - Name: name, - EncryptedEmail: email, - CheckData: checkData, - TriggerConfig: encodedLogTriggerConfig, - OffchainConfig: []byte{}, - } - - req, err := registrarABI.Methods["registerUpkeep"].Inputs.Pack(¶ms) - return req, err - } - - params := registrar23.AutomationRegistrar23RegistrationParams{ - UpkeepContract: common.HexToAddress(upkeepAddr), - Amount: amount, - AdminAddress: common.HexToAddress(adminAddr), - GasLimit: gasLimit, - TriggerType: uint8(0), // trigger type - BillingToken: common.HexToAddress(linkTokenAddr), - Name: name, - EncryptedEmail: email, - CheckData: checkData, - TriggerConfig: []byte{}, - OffchainConfig: []byte{}, - } - - encodedRegistrationParamsStruct, err := registrarABI.Methods["registerUpkeep"].Inputs.Pack(¶ms) - - return encodedRegistrationParamsStruct, err - } - registryABI, err := abi.JSON(strings.NewReader(keeper_registrar_wrapper1_2.KeeperRegistrarMetaData.ABI)) - if err != nil { - return nil, err - } - req, err := registryABI.Pack( - "register", - name, - email, - common.HexToAddress(upkeepAddr), - gasLimit, - common.HexToAddress(adminAddr), - checkData, - amount, - source, - common.HexToAddress(senderAddr), - ) - if err != nil { - return nil, err - } - return req, nil -} - -func DeployKeeperRegistrar(client *seth.Client, registryVersion eth_contracts.KeeperRegistryVersion, linkAddr string, registrarSettings KeeperRegistrarSettings) (KeeperRegistrar, error) { - switch registryVersion { - case eth_contracts.RegistryVersion_2_0: - abi, err := keeper_registrar_wrapper2_0.KeeperRegistrarMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to get KeeperRegistrar2_0 ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistrar2_0", *abi, common.FromHex(keeper_registrar_wrapper2_0.KeeperRegistrarMetaData.Bin), - common.HexToAddress(linkAddr), - registrarSettings.AutoApproveConfigType, - registrarSettings.AutoApproveMaxAllowed, - common.HexToAddress(registrarSettings.RegistryAddr), - registrarSettings.MinLinkJuels, - ) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("KeeperRegistrar2_0 instance deployment have failed: %w", err) - } - - instance, err := keeper_registrar_wrapper2_0.NewKeeperRegistrar(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to instantiate KeeperRegistrar2_0 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - client: client, - registrar20: instance, - address: &data.Address, - }, nil - case eth_contracts.RegistryVersion_2_1, eth_contracts.RegistryVersion_2_2: // both 2.1 and 2.2 registry use registrar 2.1 - abi, err := registrar21.AutomationRegistrarMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to get KeeperRegistrar2_1 ABI: %w", err) - } - // set default TriggerType to 0(conditional), AutoApproveConfigType to 2(auto approve enabled), AutoApproveMaxAllowed to 1000 - triggerConfigs := []registrar21.AutomationRegistrar21InitialTriggerConfig{ - {TriggerType: 0, AutoApproveType: registrarSettings.AutoApproveConfigType, - AutoApproveMaxAllowed: uint32(registrarSettings.AutoApproveMaxAllowed)}, - {TriggerType: 1, AutoApproveType: registrarSettings.AutoApproveConfigType, - AutoApproveMaxAllowed: uint32(registrarSettings.AutoApproveMaxAllowed)}, - } - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistrar2_1", *abi, common.FromHex(registrar21.AutomationRegistrarMetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(registrarSettings.RegistryAddr), - registrarSettings.MinLinkJuels, - triggerConfigs, - ) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("KeeperRegistrar2_1 instance deployment have failed: %w", err) - } - - instance, err := registrar21.NewAutomationRegistrar(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to instantiate KeeperRegistrar2_1 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - client: client, - registrar21: instance, - address: &data.Address, - }, nil - case eth_contracts.RegistryVersion_2_3: - abi, err := registrar23.AutomationRegistrarMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to get KeeperRegistrar2_3 ABI: %w", err) - } - // set default TriggerType to 0(conditional), AutoApproveConfigType to 2(auto approve enabled), AutoApproveMaxAllowed to 1000 - triggerConfigs := []registrar23.AutomationRegistrar23InitialTriggerConfig{ - {TriggerType: 0, AutoApproveType: registrarSettings.AutoApproveConfigType, - AutoApproveMaxAllowed: uint32(registrarSettings.AutoApproveMaxAllowed)}, - {TriggerType: 1, AutoApproveType: registrarSettings.AutoApproveConfigType, - AutoApproveMaxAllowed: uint32(registrarSettings.AutoApproveMaxAllowed)}, - } - - billingTokens := []common.Address{ - common.HexToAddress(linkAddr), - common.HexToAddress(registrarSettings.WETHTokenAddr), - } - minRegistrationFees := []*big.Int{ - big.NewInt(10), - big.NewInt(10), - } - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistrar2_3", *abi, common.FromHex(registrar23.AutomationRegistrarMetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(registrarSettings.RegistryAddr), - triggerConfigs, - billingTokens, - minRegistrationFees, - common.HexToAddress(registrarSettings.WETHTokenAddr), - ) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("KeeperRegistrar2_3 instance deployment have failed: %w", err) - } - - instance, err := registrar23.NewAutomationRegistrar(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to instantiate KeeperRegistrar2_3 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - client: client, - registrar23: instance, - address: &data.Address, - }, nil - } - - // non OCR registrar - abi, err := keeper_registrar_wrapper1_2.KeeperRegistrarMetaData.GetAbi() - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to get KeeperRegistrar1_2 ABI: %w", err) - } - - data, err := client.DeployContract(client.NewTXOpts(), "KeeperRegistrar1_2", *abi, common.FromHex(keeper_registrar_wrapper1_2.KeeperRegistrarMetaData.Bin), - common.HexToAddress(linkAddr), - registrarSettings.AutoApproveConfigType, - registrarSettings.AutoApproveMaxAllowed, - common.HexToAddress(registrarSettings.RegistryAddr), - registrarSettings.MinLinkJuels, - ) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("KeeperRegistrar1_2 instance deployment have failed: %w", err) - } - - instance, err := keeper_registrar_wrapper1_2.NewKeeperRegistrar(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to instantiate KeeperRegistrar1_2 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - client: client, - registrar: instance, - address: &data.Address, - }, nil -} - -// LoadKeeperRegistrar returns deployed on given address EthereumKeeperRegistrar -func LoadKeeperRegistrar(client *seth.Client, address common.Address, registryVersion eth_contracts.KeeperRegistryVersion) (KeeperRegistrar, error) { - switch registryVersion { - case eth_contracts.RegistryVersion_1_1, eth_contracts.RegistryVersion_1_2, eth_contracts.RegistryVersion_1_3: - loader := seth.NewContractLoader[keeper_registrar_wrapper1_2.KeeperRegistrar](client) - instance, err := loader.LoadContract("KeeperRegistrar1_2", address, keeper_registrar_wrapper1_2.KeeperRegistrarMetaData.GetAbi, keeper_registrar_wrapper1_2.NewKeeperRegistrar) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to load KeeperRegistrar1_2 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - address: &address, - client: client, - registrar: instance, - }, err - case eth_contracts.RegistryVersion_2_0: - loader := seth.NewContractLoader[keeper_registrar_wrapper2_0.KeeperRegistrar](client) - instance, err := loader.LoadContract("KeeperRegistrar2_0", address, keeper_registrar_wrapper2_0.KeeperRegistrarMetaData.GetAbi, keeper_registrar_wrapper2_0.NewKeeperRegistrar) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to load KeeperRegistrar2_0 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - address: &address, - client: client, - registrar20: instance, - }, nil - case eth_contracts.RegistryVersion_2_1, eth_contracts.RegistryVersion_2_2: - loader := seth.NewContractLoader[registrar21.AutomationRegistrar](client) - instance, err := loader.LoadContract("KeeperRegistrar2_1", address, registrar21.AutomationRegistrarMetaData.GetAbi, registrar21.NewAutomationRegistrar) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to load KeeperRegistrar2_1 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - address: &address, - client: client, - registrar21: instance, - }, nil - case eth_contracts.RegistryVersion_2_3: - loader := seth.NewContractLoader[registrar23.AutomationRegistrar](client) - instance, err := loader.LoadContract("KeeperRegistrar2_3", address, registrar23.AutomationRegistrarMetaData.GetAbi, registrar23.NewAutomationRegistrar) - if err != nil { - return &EthereumKeeperRegistrar{}, fmt.Errorf("failed to load KeeperRegistrar2_3 instance: %w", err) - } - - return &EthereumKeeperRegistrar{ - address: &address, - client: client, - registrar23: instance, - }, nil - } - return &EthereumKeeperRegistrar{}, fmt.Errorf("unsupported registry version: %v", registryVersion) -} - -type EthereumAutomationKeeperConsumer struct { - client *seth.Client - consumer *log_upkeep_counter_wrapper.LogUpkeepCounter - address *common.Address -} - -func (e EthereumAutomationKeeperConsumer) Address() string { - return e.address.Hex() -} - -func (e EthereumAutomationKeeperConsumer) Counter(ctx context.Context) (*big.Int, error) { - return e.consumer.Counter(&bind.CallOpts{ - From: e.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (e EthereumAutomationKeeperConsumer) Start() error { - _, err := e.client.Decode(e.consumer.Start(e.client.NewTXOpts())) - return err -} - -func LoadKeeperConsumer(client *seth.Client, address common.Address) (*EthereumAutomationKeeperConsumer, error) { - loader := seth.NewContractLoader[log_upkeep_counter_wrapper.LogUpkeepCounter](client) - instance, err := loader.LoadContract("KeeperConsumer", address, log_upkeep_counter_wrapper.LogUpkeepCounterMetaData.GetAbi, log_upkeep_counter_wrapper.NewLogUpkeepCounter) - if err != nil { - return &EthereumAutomationKeeperConsumer{}, fmt.Errorf("failed to load KeeperConsumerMetaData instance: %w", err) - } - - return &EthereumAutomationKeeperConsumer{ - client: client, - consumer: instance, - address: &address, - }, nil -} - -type EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer struct { - client *seth.Client - consumer *log_triggered_streams_lookup_wrapper.LogTriggeredStreamsLookup - address *common.Address -} - -func (v *EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer) Address() string { - return v.address.Hex() -} - -// Kick off the log trigger event. The contract uses Mercury v0.2 so no need to set ParamKeys -func (v *EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer) Start() error { - _, err := v.client.Decode(v.consumer.Start(v.client.NewTXOpts())) - return err -} - -func (v *EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func DeployAutomationLogTriggeredStreamsLookupUpkeepConsumerFromKey(client *seth.Client, keyNum int) (KeeperConsumer, error) { - abi, err := log_triggered_streams_lookup_wrapper.LogTriggeredStreamsLookupMetaData.GetAbi() - if err != nil { - return &EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer{}, fmt.Errorf("failed to get LogTriggeredStreamsLookupUpkeep ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "LogTriggeredStreamsLookupUpkeep", *abi, common.FromHex(log_triggered_streams_lookup_wrapper.LogTriggeredStreamsLookupMetaData.Bin), false, false, false) - if err != nil { - return &EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer{}, fmt.Errorf("LogTriggeredStreamsLookupUpkeep instance deployment have failed: %w", err) - } - - instance, err := log_triggered_streams_lookup_wrapper.NewLogTriggeredStreamsLookup(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer{}, fmt.Errorf("failed to instantiate LogTriggeredStreamsLookupUpkeep instance: %w", err) - } - - return &EthereumAutomationLogTriggeredStreamsLookupUpkeepConsumer{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -type EthereumAutomationStreamsLookupUpkeepConsumer struct { - client *seth.Client - consumer *streams_lookup_upkeep_wrapper.StreamsLookupUpkeep - address *common.Address -} - -func (v *EthereumAutomationStreamsLookupUpkeepConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumAutomationStreamsLookupUpkeepConsumer) Start() error { - _, err := v.client.Decode(v.consumer.SetParamKeys(v.client.NewTXOpts(), "feedIdHex", "blockNumber")) - return err -} - -func (v *EthereumAutomationStreamsLookupUpkeepConsumer) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func DeployAutomationStreamsLookupUpkeepConsumerFromKey(client *seth.Client, keyNum int, testRange *big.Int, interval *big.Int, useArbBlock bool, staging bool, verify bool) (KeeperConsumer, error) { - abi, err := streams_lookup_upkeep_wrapper.StreamsLookupUpkeepMetaData.GetAbi() - if err != nil { - return &EthereumAutomationStreamsLookupUpkeepConsumer{}, fmt.Errorf("failed to get StreamsLookupUpkeep ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "StreamsLookupUpkeep", *abi, common.FromHex(streams_lookup_upkeep_wrapper.StreamsLookupUpkeepMetaData.Bin), - testRange, - interval, - useArbBlock, - staging, - verify, - ) - if err != nil { - return &EthereumAutomationStreamsLookupUpkeepConsumer{}, fmt.Errorf("StreamsLookupUpkeep instance deployment have failed: %w", err) - } - - instance, err := streams_lookup_upkeep_wrapper.NewStreamsLookupUpkeep(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumAutomationStreamsLookupUpkeepConsumer{}, fmt.Errorf("failed to instantiate StreamsLookupUpkeep instance: %w", err) - } - - return &EthereumAutomationStreamsLookupUpkeepConsumer{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -type EthereumAutomationLogCounterConsumer struct { - client *seth.Client - consumer *log_upkeep_counter_wrapper.LogUpkeepCounter - address *common.Address -} - -func (v *EthereumAutomationLogCounterConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumAutomationLogCounterConsumer) Start() error { - _, err := v.client.Decode(v.consumer.Start(v.client.NewTXOpts())) - return err -} - -func (v *EthereumAutomationLogCounterConsumer) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func DeployAutomationLogTriggerConsumerFromKey(client *seth.Client, keyNum int, testInterval *big.Int) (KeeperConsumer, error) { - abi, err := log_upkeep_counter_wrapper.LogUpkeepCounterMetaData.GetAbi() - if err != nil { - return &EthereumAutomationLogCounterConsumer{}, fmt.Errorf("failed to get LogUpkeepCounter ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "LogUpkeepCounter", *abi, common.FromHex(log_upkeep_counter_wrapper.LogUpkeepCounterMetaData.Bin), testInterval) - if err != nil { - return &EthereumAutomationLogCounterConsumer{}, fmt.Errorf("LogUpkeepCounter instance deployment have failed: %w", err) - } - - instance, err := log_upkeep_counter_wrapper.NewLogUpkeepCounter(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumAutomationLogCounterConsumer{}, fmt.Errorf("failed to instantiate LogUpkeepCounter instance: %w", err) - } - - return &EthereumAutomationLogCounterConsumer{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -// EthereumUpkeepCounter represents keeper consumer (upkeep) counter contract -type EthereumUpkeepCounter struct { - client *seth.Client - consumer *upkeep_counter_wrapper.UpkeepCounter - address *common.Address -} - -func (v *EthereumUpkeepCounter) Address() string { - return v.address.Hex() -} - -func (v *EthereumUpkeepCounter) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} -func (v *EthereumUpkeepCounter) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumUpkeepCounter) SetSpread(testRange *big.Int, interval *big.Int) error { - _, err := v.client.Decode(v.consumer.SetSpread(v.client.NewTXOpts(), testRange, interval)) - return err -} - -// Just pass for non-logtrigger -func (v *EthereumUpkeepCounter) Start() error { - return nil -} - -func DeployUpkeepCounterFromKey(client *seth.Client, keyNum int, testRange *big.Int, interval *big.Int) (UpkeepCounter, error) { - abi, err := upkeep_counter_wrapper.UpkeepCounterMetaData.GetAbi() - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("failed to get UpkeepCounter ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "UpkeepCounter", *abi, common.FromHex(upkeep_counter_wrapper.UpkeepCounterMetaData.Bin), testRange, interval) - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("UpkeepCounter instance deployment have failed: %w", err) - } - - instance, err := upkeep_counter_wrapper.NewUpkeepCounter(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("failed to instantiate UpkeepCounter instance: %w", err) - } - - return &EthereumUpkeepCounter{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -func DeployUpkeepCounter(client *seth.Client, testRange *big.Int, interval *big.Int) (UpkeepCounter, error) { - return DeployUpkeepCounterFromKey(client, 0, testRange, interval) -} - -// EthereumUpkeepPerformCounterRestrictive represents keeper consumer (upkeep) counter contract -type EthereumUpkeepPerformCounterRestrictive struct { - client *seth.Client - consumer *upkeep_perform_counter_restrictive_wrapper.UpkeepPerformCounterRestrictive - address *common.Address -} - -func (v *EthereumUpkeepPerformCounterRestrictive) Address() string { - return v.address.Hex() -} - -func (v *EthereumUpkeepPerformCounterRestrictive) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} -func (v *EthereumUpkeepPerformCounterRestrictive) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.GetCountPerforms(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumUpkeepPerformCounterRestrictive) SetSpread(testRange *big.Int, interval *big.Int) error { - _, err := v.client.Decode(v.consumer.SetSpread(v.client.NewTXOpts(), testRange, interval)) - return err -} - -func DeployUpkeepPerformCounterRestrictive(client *seth.Client, testRange *big.Int, averageEligibilityCadence *big.Int) (UpkeepPerformCounterRestrictive, error) { - abi, err := upkeep_perform_counter_restrictive_wrapper.UpkeepPerformCounterRestrictiveMetaData.GetAbi() - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("failed to get UpkeepPerformCounterRestrictive ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "UpkeepPerformCounterRestrictive", *abi, common.FromHex(upkeep_perform_counter_restrictive_wrapper.UpkeepPerformCounterRestrictiveMetaData.Bin), testRange, averageEligibilityCadence) - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("UpkeepPerformCounterRestrictive instance deployment have failed: %w", err) - } - - instance, err := upkeep_perform_counter_restrictive_wrapper.NewUpkeepPerformCounterRestrictive(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumUpkeepCounter{}, fmt.Errorf("failed to instantiate UpkeepPerformCounterRestrictive instance: %w", err) - } - - return &EthereumUpkeepPerformCounterRestrictive{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -// EthereumKeeperPerformDataCheckerConsumer represents keeper perform data checker contract -type EthereumKeeperPerformDataCheckerConsumer struct { - client *seth.Client - performDataChecker *perform_data_checker_wrapper.PerformDataChecker - address *common.Address -} - -func (v *EthereumKeeperPerformDataCheckerConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumKeeperPerformDataCheckerConsumer) Counter(ctx context.Context) (*big.Int, error) { - return v.performDataChecker.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumKeeperPerformDataCheckerConsumer) SetExpectedData(_ context.Context, expectedData []byte) error { - _, err := v.client.Decode(v.performDataChecker.SetExpectedData(v.client.NewTXOpts(), expectedData)) - return err -} - -func DeployKeeperPerformDataChecker(client *seth.Client, expectedData []byte) (KeeperPerformDataChecker, error) { - abi, err := perform_data_checker_wrapper.PerformDataCheckerMetaData.GetAbi() - if err != nil { - return &EthereumKeeperPerformDataCheckerConsumer{}, fmt.Errorf("failed to get PerformDataChecker ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "PerformDataChecker", *abi, common.FromHex(perform_data_checker_wrapper.PerformDataCheckerMetaData.Bin), expectedData) - if err != nil { - return &EthereumKeeperPerformDataCheckerConsumer{}, fmt.Errorf("PerformDataChecker instance deployment have failed: %w", err) - } - - instance, err := perform_data_checker_wrapper.NewPerformDataChecker(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperPerformDataCheckerConsumer{}, fmt.Errorf("failed to instantiate PerformDataChecker instance: %w", err) - } - - return &EthereumKeeperPerformDataCheckerConsumer{ - client: client, - performDataChecker: instance, - address: &data.Address, - }, nil -} - -// EthereumKeeperConsumerPerformance represents a more complicated keeper consumer contract, one intended only for -// performance tests. -type EthereumKeeperConsumerPerformance struct { - client *seth.Client - consumer *keeper_consumer_performance_wrapper.KeeperConsumerPerformance - address *common.Address -} - -func (v *EthereumKeeperConsumerPerformance) Address() string { - return v.address.Hex() -} - -func (v *EthereumKeeperConsumerPerformance) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} - -func (v *EthereumKeeperConsumerPerformance) CheckEligible(ctx context.Context) (bool, error) { - return v.consumer.CheckEligible(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumKeeperConsumerPerformance) GetUpkeepCount(ctx context.Context) (*big.Int, error) { - return v.consumer.GetCountPerforms(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumKeeperConsumerPerformance) SetCheckGasToBurn(_ context.Context, gas *big.Int) error { - _, err := v.client.Decode(v.consumer.SetCheckGasToBurn(v.client.NewTXOpts(), gas)) - return err -} - -func (v *EthereumKeeperConsumerPerformance) SetPerformGasToBurn(_ context.Context, gas *big.Int) error { - _, err := v.client.Decode(v.consumer.SetPerformGasToBurn(v.client.NewTXOpts(), gas)) - return err -} - -func DeployKeeperConsumerPerformance( - client *seth.Client, - testBlockRange, - averageCadence, - checkGasToBurn, - performGasToBurn *big.Int, -) (KeeperConsumerPerformance, error) { - abi, err := keeper_consumer_performance_wrapper.KeeperConsumerPerformanceMetaData.GetAbi() - if err != nil { - return &EthereumKeeperConsumerPerformance{}, fmt.Errorf("failed to get KeeperConsumerPerformance ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "KeeperConsumerPerformance", *abi, common.FromHex(keeper_consumer_performance_wrapper.KeeperConsumerPerformanceMetaData.Bin), - testBlockRange, - averageCadence, - checkGasToBurn, - performGasToBurn) - if err != nil { - return &EthereumKeeperConsumerPerformance{}, fmt.Errorf("KeeperConsumerPerformance instance deployment have failed: %w", err) - } - - instance, err := keeper_consumer_performance_wrapper.NewKeeperConsumerPerformance(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumKeeperConsumerPerformance{}, fmt.Errorf("failed to instantiate KeeperConsumerPerformance instance: %w", err) - } - - return &EthereumKeeperConsumerPerformance{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -type EthereumAutomationSimpleLogCounterConsumer struct { - client *seth.Client - consumer *simple_log_upkeep_counter_wrapper.SimpleLogUpkeepCounter - address *common.Address -} - -func (v *EthereumAutomationSimpleLogCounterConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumAutomationSimpleLogCounterConsumer) Start() error { - return nil -} - -func (v *EthereumAutomationSimpleLogCounterConsumer) Counter(ctx context.Context) (*big.Int, error) { - return v.consumer.Counter(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func DeployAutomationSimpleLogTriggerConsumerFromKey(client *seth.Client, isStreamsLookup bool, keyNum int) (KeeperConsumer, error) { - abi, err := simple_log_upkeep_counter_wrapper.SimpleLogUpkeepCounterMetaData.GetAbi() - if err != nil { - return &EthereumAutomationSimpleLogCounterConsumer{}, fmt.Errorf("failed to get SimpleLogUpkeepCounter ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "SimpleLogUpkeepCounter", *abi, common.FromHex(simple_log_upkeep_counter_wrapper.SimpleLogUpkeepCounterMetaData.Bin), isStreamsLookup) - if err != nil { - return &EthereumAutomationSimpleLogCounterConsumer{}, fmt.Errorf("SimpleLogUpkeepCounter instance deployment have failed: %w", err) - } - - instance, err := simple_log_upkeep_counter_wrapper.NewSimpleLogUpkeepCounter(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumAutomationSimpleLogCounterConsumer{}, fmt.Errorf("failed to instantiate SimpleLogUpkeepCounter instance: %w", err) - } - - return &EthereumAutomationSimpleLogCounterConsumer{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -// EthereumAutomationConsumerBenchmark represents a more complicated keeper consumer contract, one intended only for -// Benchmark tests. -type EthereumAutomationConsumerBenchmark struct { - client *seth.Client - consumer *automation_consumer_benchmark.AutomationConsumerBenchmark - address *common.Address -} - -func (v *EthereumAutomationConsumerBenchmark) Address() string { - return v.address.Hex() -} - -func (v *EthereumAutomationConsumerBenchmark) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds instead") -} - -func (v *EthereumAutomationConsumerBenchmark) CheckEligible(ctx context.Context, id *big.Int, _range *big.Int, firstEligibleBuffer *big.Int) (bool, error) { - return v.consumer.CheckEligible(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, id, _range, firstEligibleBuffer) -} - -func (v *EthereumAutomationConsumerBenchmark) GetUpkeepCount(ctx context.Context, id *big.Int) (*big.Int, error) { - return v.consumer.GetCountPerforms(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, id) -} - -// DeployAutomationConsumerBenchmark deploys a keeper consumer benchmark contract with a standard contract backend -func DeployAutomationConsumerBenchmark(client *seth.Client) (AutomationConsumerBenchmark, error) { - return deployAutomationConsumerBenchmarkWithWrapperFn(client, func(client *seth.Client) *wrappers.WrappedContractBackend { - return wrappers.MustNewWrappedContractBackend(nil, client) - }) -} - -func LoadAutomationConsumerBenchmark(client *seth.Client, address common.Address) (*EthereumAutomationConsumerBenchmark, error) { - loader := seth.NewContractLoader[automation_consumer_benchmark.AutomationConsumerBenchmark](client) - instance, err := loader.LoadContract("AutomationConsumerBenchmark", address, automation_consumer_benchmark.AutomationConsumerBenchmarkMetaData.GetAbi, automation_consumer_benchmark.NewAutomationConsumerBenchmark) - if err != nil { - return &EthereumAutomationConsumerBenchmark{}, fmt.Errorf("failed to load AutomationConsumerBenchmark instance: %w", err) - } - - return &EthereumAutomationConsumerBenchmark{ - client: client, - consumer: instance, - address: &address, - }, nil -} - -// DeployAutomationConsumerBenchmarkWithRetry deploys a keeper consumer benchmark contract with a read-only operations retrying contract backend -func DeployAutomationConsumerBenchmarkWithRetry(client *seth.Client, logger zerolog.Logger, maxAttempts uint, retryDelay time.Duration) (AutomationConsumerBenchmark, error) { - return deployAutomationConsumerBenchmarkWithWrapperFn(client, func(client *seth.Client) *wrappers.WrappedContractBackend { - return wrappers.MustNewRetryingWrappedContractBackend(client, logger, maxAttempts, retryDelay) - }) -} - -func deployAutomationConsumerBenchmarkWithWrapperFn(client *seth.Client, wrapperConstrFn func(client *seth.Client) *wrappers.WrappedContractBackend) (AutomationConsumerBenchmark, error) { - abi, err := automation_consumer_benchmark.AutomationConsumerBenchmarkMetaData.GetAbi() - if err != nil { - return &EthereumAutomationConsumerBenchmark{}, fmt.Errorf("failed to get AutomationConsumerBenchmark ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXOpts(), "AutomationConsumerBenchmark", *abi, common.FromHex(automation_consumer_benchmark.AutomationConsumerBenchmarkMetaData.Bin)) - if err != nil { - return &EthereumAutomationConsumerBenchmark{}, fmt.Errorf("AutomationConsumerBenchmark instance deployment have failed: %w", err) - } - - instance, err := automation_consumer_benchmark.NewAutomationConsumerBenchmark(data.Address, wrapperConstrFn(client)) - if err != nil { - return &EthereumAutomationConsumerBenchmark{}, fmt.Errorf("failed to instantiate AutomationConsumerBenchmark instance: %w", err) - } - - return &EthereumAutomationConsumerBenchmark{ - client: client, - consumer: instance, - address: &data.Address, - }, nil -} - -// AutomationConsumerBenchmarkUpkeepObserver is a header subscription that awaits for a round of upkeeps -type AutomationConsumerBenchmarkUpkeepObserver struct { - instance AutomationConsumerBenchmark - registry KeeperRegistry - upkeepID *big.Int - - firstBlockNum uint64 // Records the number of the first block that came in - lastBlockNum uint64 // Records the number of the last block that came in - blockRange uint64 // How many blocks to watch upkeeps for - upkeepSLA int64 // SLA after which an upkeep is counted as 'missed' - metricsReporter *testreporters.KeeperBenchmarkTestReporter // Testreporter to track results - upkeepIndex int64 - firstEligibleBuffer int64 - - // State variables, changes as we get blocks - blocksSinceSubscription uint64 // How many blocks have passed since subscribing - blocksSinceEligible int64 // How many blocks have come in since upkeep has been eligible for check - countEligible int64 // Number of times the upkeep became eligible - countMissed int64 // Number of times we missed SLA for performing upkeep - upkeepCount int64 // The count of upkeeps done so far - allCheckDelays []int64 // Tracks the amount of blocks missed before an upkeep since it became eligible - complete bool - l zerolog.Logger -} - -// NewAutomationConsumerBenchmarkUpkeepObserver provides a new instance of a NewAutomationConsumerBenchmarkUpkeepObserver -// Used to track and log benchmark test results for keepers -func NewAutomationConsumerBenchmarkUpkeepObserver( - contract AutomationConsumerBenchmark, - registry KeeperRegistry, - upkeepID *big.Int, - blockRange uint64, - upkeepSLA int64, - metricsReporter *testreporters.KeeperBenchmarkTestReporter, - upkeepIndex int64, - firstEligibleBuffer int64, - logger zerolog.Logger, -) *AutomationConsumerBenchmarkUpkeepObserver { - return &AutomationConsumerBenchmarkUpkeepObserver{ - instance: contract, - registry: registry, - upkeepID: upkeepID, - blockRange: blockRange, - upkeepSLA: upkeepSLA, - blocksSinceSubscription: 0, - blocksSinceEligible: 0, - upkeepCount: 0, - allCheckDelays: []int64{}, - metricsReporter: metricsReporter, - complete: false, - lastBlockNum: 0, - upkeepIndex: upkeepIndex, - firstBlockNum: 0, - firstEligibleBuffer: firstEligibleBuffer, - l: logger, - } -} - -// ReceiveHeader will query the latest Keeper round and check to see whether upkeep was performed, it returns -// true when observation has finished. -func (o *AutomationConsumerBenchmarkUpkeepObserver) ReceiveHeader(receivedHeader *blockchain.SafeEVMHeader) (bool, error) { - if receivedHeader.Number.Uint64() <= o.lastBlockNum { // Uncle / reorg we won't count - return false, nil - } - if o.firstBlockNum == 0 { - o.firstBlockNum = receivedHeader.Number.Uint64() - } - o.lastBlockNum = receivedHeader.Number.Uint64() - // Increment block counters - o.blocksSinceSubscription++ - - upkeepCount, err := o.instance.GetUpkeepCount(context.Background(), big.NewInt(o.upkeepIndex)) - if err != nil { - return false, err - } - - if upkeepCount.Int64() > o.upkeepCount { // A new upkeep was done - if upkeepCount.Int64() != o.upkeepCount+1 { - return false, errors.New("upkeep count increased by more than 1 in a single block") - } - o.l.Info(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Int64("Upkeep_Count", upkeepCount.Int64()). - Int64("Blocks_since_eligible", o.blocksSinceEligible). - Str("Registry_Address", o.registry.Address()). - Msg("Upkeep Performed") - - if o.blocksSinceEligible > o.upkeepSLA { - o.l.Warn(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Int64("Blocks_since_eligible", o.blocksSinceEligible). - Str("Registry_Address", o.registry.Address()). - Msg("Upkeep Missed SLA") - o.countMissed++ - } - - o.allCheckDelays = append(o.allCheckDelays, o.blocksSinceEligible) - o.upkeepCount++ - o.blocksSinceEligible = 0 - } - - isEligible, err := o.instance.CheckEligible(context.Background(), big.NewInt(o.upkeepIndex), new(big.Int).SetUint64(o.blockRange), big.NewInt(o.firstEligibleBuffer)) - if err != nil { - return false, err - } - if isEligible { - if o.blocksSinceEligible == 0 { - // First time this upkeep became eligible - o.countEligible++ - o.l.Info(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Str("Registry_Address", o.registry.Address()). - Msg("Upkeep Now Eligible") - } - o.blocksSinceEligible++ - } - - if o.blocksSinceSubscription >= o.blockRange || o.lastBlockNum-o.firstBlockNum >= o.blockRange { - if o.blocksSinceEligible > 0 { - if o.blocksSinceEligible > o.upkeepSLA { - o.l.Warn(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Int64("Blocks_since_eligible", o.blocksSinceEligible). - Str("Registry_Address", o.registry.Address()). - Msg("Upkeep remained eligible at end of test and missed SLA") - o.countMissed++ - } else { - o.l.Info(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Int64("Upkeep_Count", upkeepCount.Int64()). - Int64("Blocks_since_eligible", o.blocksSinceEligible). - Str("Registry_Address", o.registry.Address()). - Msg("Upkeep remained eligible at end of test and was within SLA") - } - o.allCheckDelays = append(o.allCheckDelays, o.blocksSinceEligible) - } - - o.l.Info(). - Uint64("Block_Number", receivedHeader.Number.Uint64()). - Str("Upkeep_ID", o.upkeepID.String()). - Str("Contract_Address", o.instance.Address()). - Int64("Upkeeps_Performed", upkeepCount.Int64()). - Uint64("Total_Blocks_Watched", o.blocksSinceSubscription). - Str("Registry_Address", o.registry.Address()). - Msg("Finished Watching for Upkeeps") - - o.complete = true - return true, nil - } - return false, nil -} - -// Complete returns whether watching for upkeeps has completed -func (o *AutomationConsumerBenchmarkUpkeepObserver) Complete() bool { - return o.complete -} - -// LogDetails logs the results of the benchmark test to testreporter -func (o *AutomationConsumerBenchmarkUpkeepObserver) LogDetails() { - report := testreporters.KeeperBenchmarkTestReport{ - ContractAddress: o.instance.Address(), - TotalEligibleCount: o.countEligible, - TotalSLAMissedUpkeeps: o.countMissed, - TotalPerformedUpkeeps: o.upkeepCount, - AllCheckDelays: o.allCheckDelays, - RegistryAddress: o.registry.Address(), - } - o.metricsReporter.ReportMutex.Lock() - o.metricsReporter.Reports = append(o.metricsReporter.Reports, report) - defer o.metricsReporter.ReportMutex.Unlock() -} diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go deleted file mode 100644 index 796132ad3b7..00000000000 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ /dev/null @@ -1,272 +0,0 @@ -package contracts - -import ( - "context" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - goabi "github.com/umbracle/ethgo/abi" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - - ac "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_compatible_utils" - registrar21 "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_registrar_wrapper2_1" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" - cltypes "github.com/smartcontractkit/chainlink-evm/pkg/types" -) - -var compatibleUtils = cltypes.MustGetABI(ac.AutomationCompatibleUtilsABI) -var registrarABI = cltypes.MustGetABI(registrar21.AutomationRegistrarABI) - -type KeeperRegistrar interface { - Address() string - - EncodeRegisterRequest(name string, email []byte, upkeepAddr string, gasLimit uint32, adminAddr string, checkData []byte, amount *big.Int, source uint8, senderAddr string, isLogTrigger bool, isMercury bool, linkTokenAddr string) ([]byte, error) - - Fund(ethAmount *big.Float) error - - RegisterUpkeepFromKey(keyNum int, name string, email []byte, upkeepAddr string, gasLimit uint32, adminAddr string, checkData []byte, amount *big.Int, wethTokenAddr string, isLogTrigger bool, isMercury bool) (*types.Transaction, error) -} - -type UpkeepTranscoder interface { - Address() string -} - -type KeeperRegistry interface { - Address() string - Fund(ethAmount *big.Float) error - SetConfig(config KeeperRegistrySettings, ocrConfig OCRv2Config) error - SetConfigTypeSafe(ocrConfig OCRv2Config) error - SetRegistrar(registrarAddr string) error - AddUpkeepFunds(id *big.Int, amount *big.Int) error - AddUpkeepFundsFromKey(id *big.Int, amount *big.Int, keyNum int) error - GetUpkeepInfo(ctx context.Context, id *big.Int) (*UpkeepInfo, error) - GetKeeperInfo(ctx context.Context, keeperAddr string) (*KeeperInfo, error) - SetKeepers(keepers []string, payees []string, ocrConfig OCRv2Config) error - GetKeeperList(ctx context.Context) ([]string, error) - RegisterUpkeep(target string, gasLimit uint32, admin string, checkData []byte) error - CancelUpkeep(id *big.Int) error - SetUpkeepGasLimit(id *big.Int, gas uint32) error - ParseUpkeepPerformedLog(log *types.Log) (*UpkeepPerformedLog, error) - ParseStaleUpkeepReportLog(log *types.Log) (*StaleUpkeepReportLog, error) - ParseUpkeepIdFromRegisteredLog(log *types.Log) (*big.Int, error) - Pause() error - Migrate(upkeepIDs []*big.Int, destinationAddress common.Address) error - SetMigrationPermissions(peerAddress common.Address, permission uint8) error - PauseUpkeep(id *big.Int) error - UnpauseUpkeep(id *big.Int) error - UpdateCheckData(id *big.Int, newCheckData []byte) error - SetUpkeepTriggerConfig(id *big.Int, triggerConfig []byte) error - SetUpkeepPrivilegeConfig(id *big.Int, privilegeConfig []byte) error - SetUpkeepOffchainConfig(id *big.Int, offchainConfig []byte) error - RegistryOwnerAddress() common.Address - ChainModuleAddress() common.Address - ReorgProtectionEnabled() bool -} - -type KeeperConsumer interface { - Address() string - Counter(ctx context.Context) (*big.Int, error) - Start() error -} - -type UpkeepCounter interface { - Address() string - Fund(ethAmount *big.Float) error - Counter(ctx context.Context) (*big.Int, error) - SetSpread(testRange *big.Int, interval *big.Int) error - Start() error -} - -type UpkeepPerformCounterRestrictive interface { - Address() string - Fund(ethAmount *big.Float) error - Counter(ctx context.Context) (*big.Int, error) - SetSpread(testRange *big.Int, interval *big.Int) error -} - -// KeeperConsumerPerformance is a keeper consumer contract that is more complicated than the typical consumer, -// it's intended to only be used for performance tests. -type KeeperConsumerPerformance interface { - Address() string - Fund(ethAmount *big.Float) error - CheckEligible(ctx context.Context) (bool, error) - GetUpkeepCount(ctx context.Context) (*big.Int, error) - SetCheckGasToBurn(ctx context.Context, gas *big.Int) error - SetPerformGasToBurn(ctx context.Context, gas *big.Int) error -} - -// AutomationConsumerBenchmark is a keeper consumer contract that is more complicated than the typical consumer, -// it's intended to only be used for benchmark tests. -type AutomationConsumerBenchmark interface { - Address() string - Fund(ethAmount *big.Float) error - CheckEligible(ctx context.Context, id *big.Int, _range *big.Int, firstEligibleBuffer *big.Int) (bool, error) - GetUpkeepCount(ctx context.Context, id *big.Int) (*big.Int, error) -} - -type KeeperPerformDataChecker interface { - Address() string - Counter(ctx context.Context) (*big.Int, error) - SetExpectedData(ctx context.Context, expectedData []byte) error -} - -type UpkeepPerformedLog struct { - Id *big.Int - Success bool - From common.Address -} - -type StaleUpkeepReportLog struct { - Id *big.Int -} - -// KeeperRegistryOpts opts to deploy keeper registry version -type KeeperRegistryOpts struct { - RegistryVersion ethereum.KeeperRegistryVersion - LinkAddr string - ETHFeedAddr string - GasFeedAddr string - TranscoderAddr string - RegistrarAddr string - Settings KeeperRegistrySettings - LinkUSDFeedAddr string - NativeUSDFeedAddr string - WrappedNativeAddr string -} - -// KeeperRegistrySettings represents the settings to fine tune keeper registry -type KeeperRegistrySettings struct { - PaymentPremiumPPB uint32 // payment premium rate oracles receive on top of being reimbursed for gas, measured in parts per billion - FlatFeeMicroLINK uint32 // flat fee charged for each upkeep - BlockCountPerTurn *big.Int // number of blocks each oracle has during their turn to perform upkeep before it will be the next keeper's turn to submit - CheckGasLimit uint32 // gas limit when checking for upkeep - StalenessSeconds *big.Int // number of seconds that is allowed for feed data to be stale before switching to the fallback pricing - GasCeilingMultiplier uint16 // multiplier to apply to the fast gas feed price when calculating the payment ceiling for keepers - MinUpkeepSpend *big.Int // minimum spend required by an upkeep before they can withdraw funds - MaxPerformGas uint32 // max gas allowed for an upkeep within perform - FallbackGasPrice *big.Int // gas price used if the gas price feed is stale - FallbackLinkPrice *big.Int // LINK price used if the LINK price feed is stale - FallbackNativePrice *big.Int // Native price used if the Native price feed is stale - MaxCheckDataSize uint32 - MaxPerformDataSize uint32 - MaxRevertDataSize uint32 - RegistryVersion ethereum.KeeperRegistryVersion -} - -func (rcs *KeeperRegistrySettings) Create23OnchainConfig(registrar string, registryOwnerAddress, chainModuleAddress common.Address, reorgProtectionEnabled bool) i_automation_registry_master_wrapper_2_3.AutomationRegistryBase23OnchainConfig { - return i_automation_registry_master_wrapper_2_3.AutomationRegistryBase23OnchainConfig{ - CheckGasLimit: rcs.CheckGasLimit, - StalenessSeconds: rcs.StalenessSeconds, - GasCeilingMultiplier: rcs.GasCeilingMultiplier, - MaxPerformGas: rcs.MaxPerformGas, - MaxCheckDataSize: rcs.MaxCheckDataSize, - MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: rcs.MaxRevertDataSize, - FallbackGasPrice: rcs.FallbackGasPrice, - FallbackLinkPrice: rcs.FallbackLinkPrice, - Transcoder: common.Address{}, - Registrars: []common.Address{common.HexToAddress(registrar)}, - UpkeepPrivilegeManager: registryOwnerAddress, - ChainModule: chainModuleAddress, - ReorgProtectionEnabled: reorgProtectionEnabled, - FinanceAdmin: registryOwnerAddress, - FallbackNativePrice: rcs.FallbackNativePrice, - } -} - -func (rcs *KeeperRegistrySettings) Encode20OnchainConfig(registrar string) []byte { - configType := goabi.MustNewType("tuple(uint32 paymentPremiumPPB,uint32 flatFeeMicroLink,uint32 checkGasLimit,uint24 stalenessSeconds,uint16 gasCeilingMultiplier,uint96 minUpkeepSpend,uint32 maxPerformGas,uint32 maxCheckDataSize,uint32 maxPerformDataSize,uint256 fallbackGasPrice,uint256 fallbackLinkPrice,address transcoder,address registrar)") - onchainConfig, _ := goabi.Encode(map[string]any{ - "paymentPremiumPPB": rcs.PaymentPremiumPPB, - "flatFeeMicroLink": rcs.FlatFeeMicroLINK, - "checkGasLimit": rcs.CheckGasLimit, - "stalenessSeconds": rcs.StalenessSeconds, - "gasCeilingMultiplier": rcs.GasCeilingMultiplier, - "minUpkeepSpend": rcs.MinUpkeepSpend, - "maxPerformGas": rcs.MaxPerformGas, - "maxCheckDataSize": rcs.MaxCheckDataSize, - "maxPerformDataSize": rcs.MaxPerformDataSize, - "fallbackGasPrice": rcs.FallbackGasPrice, - "fallbackLinkPrice": rcs.FallbackLinkPrice, - "transcoder": common.Address{}, - "registrar": registrar, - }, configType) - return onchainConfig -} - -func (rcs *KeeperRegistrySettings) Create22OnchainConfig(registrar string, registryOwnerAddress, chainModuleAddress common.Address, reorgProtectionEnabled bool) i_automation_registry_master_wrapper_2_2.AutomationRegistryBase22OnchainConfig { - return i_automation_registry_master_wrapper_2_2.AutomationRegistryBase22OnchainConfig{ - PaymentPremiumPPB: rcs.PaymentPremiumPPB, - FlatFeeMicroLink: rcs.FlatFeeMicroLINK, - CheckGasLimit: rcs.CheckGasLimit, - StalenessSeconds: rcs.StalenessSeconds, - GasCeilingMultiplier: rcs.GasCeilingMultiplier, - MinUpkeepSpend: rcs.MinUpkeepSpend, - MaxPerformGas: rcs.MaxPerformGas, - MaxCheckDataSize: rcs.MaxCheckDataSize, - MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: rcs.MaxRevertDataSize, - FallbackGasPrice: rcs.FallbackGasPrice, - FallbackLinkPrice: rcs.FallbackLinkPrice, - Transcoder: common.Address{}, - Registrars: []common.Address{common.HexToAddress(registrar)}, - UpkeepPrivilegeManager: registryOwnerAddress, - ChainModule: chainModuleAddress, - ReorgProtectionEnabled: reorgProtectionEnabled, - } -} - -func (rcs *KeeperRegistrySettings) Create21OnchainConfig(registrar string, registryOwnerAddress common.Address) i_keeper_registry_master_wrapper_2_1.IAutomationV21PlusCommonOnchainConfigLegacy { - return i_keeper_registry_master_wrapper_2_1.IAutomationV21PlusCommonOnchainConfigLegacy{ - PaymentPremiumPPB: rcs.PaymentPremiumPPB, - FlatFeeMicroLink: rcs.FlatFeeMicroLINK, - CheckGasLimit: rcs.CheckGasLimit, - StalenessSeconds: rcs.StalenessSeconds, - GasCeilingMultiplier: rcs.GasCeilingMultiplier, - MinUpkeepSpend: rcs.MinUpkeepSpend, - MaxPerformGas: rcs.MaxPerformGas, - MaxCheckDataSize: rcs.MaxCheckDataSize, - MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: rcs.MaxRevertDataSize, - FallbackGasPrice: rcs.FallbackGasPrice, - FallbackLinkPrice: rcs.FallbackLinkPrice, - Transcoder: common.Address{}, - Registrars: []common.Address{common.HexToAddress(registrar)}, - UpkeepPrivilegeManager: registryOwnerAddress, - } -} - -// KeeperRegistrarSettings represents settings for registrar contract -type KeeperRegistrarSettings struct { - AutoApproveConfigType uint8 - AutoApproveMaxAllowed uint16 - RegistryAddr string - MinLinkJuels *big.Int - WETHTokenAddr string -} - -// KeeperInfo keeper status and balance info -type KeeperInfo struct { - Payee string - Active bool - Balance *big.Int -} - -// UpkeepInfo keeper target info -type UpkeepInfo struct { - Target string - ExecuteGas uint32 - CheckData []byte - Balance *big.Int - LastKeeper string - Admin string - MaxValidBlocknumber uint64 - LastPerformBlockNumber uint32 - AmountSpent *big.Int - Paused bool - OffchainConfig []byte -} diff --git a/integration-tests/contracts/ethereum_vrf_common.go b/integration-tests/contracts/ethereum_vrf_common.go deleted file mode 100644 index 8f44d35d691..00000000000 --- a/integration-tests/contracts/ethereum_vrf_common.go +++ /dev/null @@ -1,121 +0,0 @@ -package contracts - -import ( - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5" -) - -type Coordinator interface { - ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) - ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) - Address() string - WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) - WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) - FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) -} - -type Subscription struct { - Balance *big.Int - NativeBalance *big.Int - ReqCount uint64 - SubOwner common.Address - Consumers []common.Address -} - -type CoordinatorConfigSet struct { - MinimumRequestConfirmations uint16 - MaxGasLimit uint32 - StalenessSeconds uint32 - GasAfterPaymentCalculation uint32 - FallbackWeiPerUnitLink *big.Int - FulfillmentFlatFeeNativePPM uint32 - FulfillmentFlatFeeLinkDiscountPPM uint32 - NativePremiumPercentage uint8 - LinkPremiumPercentage uint8 - FeeConfig VRFCoordinatorV2FeeConfig - Raw types.Log -} - -type VRFCoordinatorV2FeeConfig struct { - FulfillmentFlatFeeLinkPPMTier1 uint32 - FulfillmentFlatFeeLinkPPMTier2 uint32 - FulfillmentFlatFeeLinkPPMTier3 uint32 - FulfillmentFlatFeeLinkPPMTier4 uint32 - FulfillmentFlatFeeLinkPPMTier5 uint32 - ReqsForTier2 *big.Int - ReqsForTier3 *big.Int - ReqsForTier4 *big.Int - ReqsForTier5 *big.Int -} - -type RandomWordsFulfilledEventFilter struct { - RequestIds []*big.Int - SubIDs []*big.Int - Timeout time.Duration -} - -type CoordinatorRandomWordsFulfilled struct { - RequestId *big.Int - OutputSeed *big.Int - SubId string - Payment *big.Int - NativePayment bool - Success bool - OnlyPremium bool - Raw types.Log -} - -type CoordinatorRandomWordsRequested struct { - KeyHash [32]byte - RequestId *big.Int - PreSeed *big.Int - SubId string - MinimumRequestConfirmations uint16 - CallbackGasLimit uint32 - NumWords uint32 - ExtraArgs []byte - Sender common.Address - Raw types.Log -} - -func parseRequestRandomnessLogs(coordinator Coordinator, logs []*types.Log) (*CoordinatorRandomWordsRequested, error) { - var randomWordsRequestedEvent *CoordinatorRandomWordsRequested - var err error - for _, eventLog := range logs { - for _, topic := range eventLog.Topics { - if topic.Cmp(vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsRequested{}.Topic()) == 0 || - topic.Cmp(vrf_coordinator_v2.VRFCoordinatorV2RandomWordsRequested{}.Topic()) == 0 { - randomWordsRequestedEvent, err = coordinator.ParseRandomWordsRequested(*eventLog) - if err != nil { - return nil, fmt.Errorf("parse RandomWordsRequested log failed, err: %w", err) - } - } - } - } - return randomWordsRequestedEvent, nil -} - -func ParseRandomWordsFulfilledLogs(coordinator Coordinator, logs []*types.Log) ([]*CoordinatorRandomWordsFulfilled, error) { - var randomWordsFulfilledEventArr []*CoordinatorRandomWordsFulfilled - for _, eventLog := range logs { - for _, topic := range eventLog.Topics { - if topic.Cmp(vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsFulfilled{}.Topic()) == 0 || - topic.Cmp(vrf_coordinator_v2.VRFCoordinatorV2RandomWordsFulfilled{}.Topic()) == 0 { - randomWordsFulfilledEvent, err := coordinator.ParseRandomWordsFulfilled(*eventLog) - if err != nil { - return nil, fmt.Errorf("parse RandomWordsFulfilled log failed, err: %w", err) - } - randomWordsFulfilledEventArr = append(randomWordsFulfilledEventArr, randomWordsFulfilledEvent) - } - } - } - return randomWordsFulfilledEventArr, nil -} diff --git a/integration-tests/contracts/ethereum_vrf_contracts.go b/integration-tests/contracts/ethereum_vrf_contracts.go deleted file mode 100644 index 4d7e7465f9c..00000000000 --- a/integration-tests/contracts/ethereum_vrf_contracts.go +++ /dev/null @@ -1,530 +0,0 @@ -package contracts - -import ( - "context" - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/rs/zerolog/log" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_load_test_with_metrics" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/batch_blockhash_store" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/blockhash_store" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/solidity_vrf_consumer_interface" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/solidity_vrf_coordinator_interface" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/solidity_vrf_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_test_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_mock_ethlink_aggregator" - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" -) - -// EthereumBlockhashStore represents a blockhash store for VRF contract -type EthereumBlockhashStore struct { - address *common.Address - client *seth.Client - blockHashStore *blockhash_store.BlockhashStore -} - -// EthereumVRFCoordinator represents VRF coordinator contract -type EthereumVRFCoordinator struct { - address *common.Address - client *seth.Client - coordinator *solidity_vrf_coordinator_interface.VRFCoordinator -} - -type EthereumVRFCoordinatorTestV2 struct { - address *common.Address - client *seth.Client - coordinator *vrf_coordinator_test_v2.VRFCoordinatorTestV2 -} - -func (v *EthereumVRFCoordinatorTestV2) Address() string { - return v.address.Hex() -} - -// EthereumVRFConsumer represents VRF consumer contract -type EthereumVRFConsumer struct { - address *common.Address - client *seth.Client - consumer *solidity_vrf_consumer_interface.VRFConsumer -} - -// EthereumVRF represents a VRF contract -type EthereumVRF struct { - client *seth.Client - vrf *solidity_vrf_wrapper.VRF - address *common.Address -} - -type EthereumVRFMockETHLINKAggregator struct { - client *seth.Client - address *common.Address - contract *vrf_mock_ethlink_aggregator.VRFMockETHLINKAggregator -} - -// EthereumBatchBlockhashStore represents BatchBlockhashStore contract -type EthereumBatchBlockhashStore struct { - address common.Address - client *seth.Client - batchBlockhashStore *batch_blockhash_store.BatchBlockhashStore -} - -// VRFConsumerRoundConfirmer is a header subscription that awaits for a certain VRF round to be completed -type VRFConsumerRoundConfirmer struct { - consumer VRFConsumer - roundID *big.Int - doneChan chan struct{} - context context.Context - cancel context.CancelFunc - done bool -} - -// ReceiveHeader will query the latest VRFConsumer round and check to see whether the round has confirmed -func (f *VRFConsumerRoundConfirmer) ReceiveHeader(header blockchain.NodeHeader) error { - if f.done { - return nil - } - roundID, err := f.consumer.CurrentRoundID(context.Background()) - if err != nil { - return err - } - logFields := map[string]any{ - "Contract Address": f.consumer.Address(), - "Waiting for Round": f.roundID.Int64(), - "Current Round ID": roundID.Int64(), - "Header Number": header.Number.Uint64(), - } - if roundID.Int64() == f.roundID.Int64() { - randomness, err := f.consumer.RandomnessOutput(context.Background()) - if err != nil { - return err - } - log.Info().Fields(logFields).Uint64("Randomness", randomness.Uint64()).Msg("VRFConsumer round completed") - f.done = true - f.doneChan <- struct{}{} - } else { - log.Debug().Fields(logFields).Msg("Waiting for VRFConsumer round") - } - return nil -} - -// Wait is a blocking function that will wait until the round has confirmed, and timeout if the deadline has passed -func (f *VRFConsumerRoundConfirmer) Wait() error { - for { - select { - case <-f.doneChan: - f.cancel() - return nil - case <-f.context.Done(): - return fmt.Errorf("timeout waiting for VRFConsumer round to confirm: %d", f.roundID) - } - } -} - -func (v *EthereumBatchBlockhashStore) Address() string { - return v.address.Hex() -} - -func (a *EthereumVRFMockETHLINKAggregator) Address() string { - return a.address.Hex() -} - -func (a *EthereumVRFMockETHLINKAggregator) LatestRoundData() (*big.Int, error) { - data, err := a.contract.LatestRoundData(a.client.NewCallOpts()) - if err != nil { - return nil, err - } - return data.Ans, nil -} - -func (a *EthereumVRFMockETHLINKAggregator) LatestRoundDataUpdatedAt() (*big.Int, error) { - data, err := a.contract.LatestRoundData(a.client.NewCallOpts()) - if err != nil { - return nil, err - } - return data.UpdatedAt, nil -} - -func (a *EthereumVRFMockETHLINKAggregator) SetBlockTimestampDeduction(blockTimestampDeduction *big.Int) error { - _, err := a.client.Decode(a.contract.SetBlockTimestampDeduction(a.client.NewTXOpts(), blockTimestampDeduction)) - return err -} - -// DeployVRFContract deploy VRFv1 contract -func DeployVRFv1Contract(seth *seth.Client) (VRF, error) { - abi, err := solidity_vrf_wrapper.VRFMetaData.GetAbi() - if err != nil { - return &EthereumVRF{}, fmt.Errorf("failed to get VRF ABI: %w", err) - } - - vrfDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRF", - *abi, - common.FromHex(solidity_vrf_wrapper.VRFMetaData.Bin)) - if err != nil { - return &EthereumVRF{}, fmt.Errorf("VRF instance deployment have failed: %w", err) - } - - vrf, err := solidity_vrf_wrapper.NewVRF(vrfDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRF{}, fmt.Errorf("failed to instantiate VRF instance: %w", err) - } - - return &EthereumVRF{ - client: seth, - vrf: vrf, - address: &vrfDeploymentData.Address, - }, err -} - -// DeployBlockhashStore deploys blockhash store used with VRF contract -func DeployBlockhashStore(seth *seth.Client) (BlockHashStore, error) { - abi, err := blockhash_store.BlockhashStoreMetaData.GetAbi() - if err != nil { - return &EthereumBlockhashStore{}, fmt.Errorf("failed to get BlockhashStore ABI: %w", err) - } - - storeDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "BlockhashStore", - *abi, - common.FromHex(blockhash_store.BlockhashStoreMetaData.Bin)) - if err != nil { - return &EthereumBlockhashStore{}, fmt.Errorf("BlockhashStore instance deployment have failed: %w", err) - } - - store, err := blockhash_store.NewBlockhashStore(storeDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBlockhashStore{}, fmt.Errorf("failed to instantiate BlockhashStore instance: %w", err) - } - - return &EthereumBlockhashStore{ - client: seth, - blockHashStore: store, - address: &storeDeploymentData.Address, - }, err -} - -// DeployVRFCoordinator deploys VRF coordinator contract -func DeployVRFCoordinator(seth *seth.Client, linkAddr, bhsAddr string) (VRFCoordinator, error) { - abi, err := solidity_vrf_coordinator_interface.VRFCoordinatorMetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinator{}, fmt.Errorf("failed to get VRFCoordinator ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinator", - *abi, - common.FromHex(solidity_vrf_coordinator_interface.VRFCoordinatorMetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(bhsAddr)) - if err != nil { - return &EthereumVRFCoordinator{}, fmt.Errorf("VRFCoordinator instance deployment have failed: %w", err) - } - - coordinator, err := solidity_vrf_coordinator_interface.NewVRFCoordinator(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinator{}, fmt.Errorf("failed to instantiate VRFCoordinator instance: %w", err) - } - - return &EthereumVRFCoordinator{ - client: seth, - coordinator: coordinator, - address: &coordinatorDeploymentData.Address, - }, err -} - -func DeployVRFCoordinatorTestV2(seth *seth.Client, linkAddr, bhsAddr, linkEthFeedAddr string) (*EthereumVRFCoordinatorTestV2, error) { - abi, err := vrf_coordinator_test_v2.VRFCoordinatorTestV2MetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorTestV2{}, fmt.Errorf("failed to get VRFCoordinatorTestV2 ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorTestV2", - *abi, - common.FromHex(vrf_coordinator_test_v2.VRFCoordinatorTestV2MetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(bhsAddr), - common.HexToAddress(linkEthFeedAddr)) - if err != nil { - return &EthereumVRFCoordinatorTestV2{}, fmt.Errorf("VRFCoordinatorTestV2 instance deployment have failed: %w", err) - } - - coordinator, err := vrf_coordinator_test_v2.NewVRFCoordinatorTestV2(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorTestV2{}, fmt.Errorf("failed to instantiate VRFCoordinatorTestV2 instance: %w", err) - } - - return &EthereumVRFCoordinatorTestV2{ - client: seth, - coordinator: coordinator, - address: &coordinatorDeploymentData.Address, - }, err -} - -// DeployVRFConsumer deploys VRF consumer contract -func DeployVRFConsumer(seth *seth.Client, linkAddr, coordinatorAddr string) (VRFConsumer, error) { - abi, err := solidity_vrf_consumer_interface.VRFConsumerMetaData.GetAbi() - if err != nil { - return &EthereumVRFConsumer{}, fmt.Errorf("failed to get VRFConsumer ABI: %w", err) - } - - consumerDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFConsumer", - *abi, - common.FromHex(solidity_vrf_consumer_interface.VRFConsumerMetaData.Bin), - common.HexToAddress(coordinatorAddr), - common.HexToAddress(linkAddr), - ) - if err != nil { - return &EthereumVRFConsumer{}, fmt.Errorf("VRFConsumer instance deployment have failed: %w", err) - } - - consumer, err := solidity_vrf_consumer_interface.NewVRFConsumer(consumerDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFConsumer{}, fmt.Errorf("failed to instantiate VRFConsumer instance: %w", err) - } - - return &EthereumVRFConsumer{ - client: seth, - consumer: consumer, - address: &consumerDeploymentData.Address, - }, err -} - -func DeployVRFMockETHLINKFeed(seth *seth.Client, answer *big.Int) (VRFMockETHLINKFeed, error) { - abi, err := vrf_mock_ethlink_aggregator.VRFMockETHLINKAggregatorMetaData.GetAbi() - if err != nil { - return &EthereumVRFMockETHLINKAggregator{}, fmt.Errorf("failed to get VRFMockETHLINKAggregator ABI: %w", err) - } - - deployment, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFMockETHLINKAggregator", - *abi, - common.FromHex(vrf_mock_ethlink_aggregator.VRFMockETHLINKAggregatorMetaData.Bin), - answer, - ) - if err != nil { - return &EthereumVRFMockETHLINKAggregator{}, fmt.Errorf("VRFMockETHLINKAggregator deployment have failed: %w", err) - } - - contract, err := vrf_mock_ethlink_aggregator.NewVRFMockETHLINKAggregator(deployment.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFMockETHLINKAggregator{}, fmt.Errorf("failed to instantiate VRFMockETHLINKAggregator instance: %w", err) - } - - return &EthereumVRFMockETHLINKAggregator{ - client: seth, - contract: contract, - address: &deployment.Address, - }, err -} - -func (v *EthereumBlockhashStore) Address() string { - return v.address.Hex() -} - -func (v *EthereumBlockhashStore) GetBlockHash(ctx context.Context, blockNumber *big.Int) ([32]byte, error) { - blockHash, err := v.blockHashStore.GetBlockhash(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, blockNumber) - if err != nil { - return [32]byte{}, err - } - return blockHash, nil -} - -func (v *EthereumBlockhashStore) StoreVerifyHeader(blockNumber *big.Int, blockHeader []byte) error { - _, err := v.client.Decode(v.blockHashStore.StoreVerifyHeader( - v.client.NewTXOpts(), - blockNumber, - blockHeader, - )) - return err -} - -func (v *EthereumVRFCoordinator) Address() string { - return v.address.Hex() -} - -// HashOfKey get a hash of proving key to use it as a request ID part for VRF -func (v *EthereumVRFCoordinator) HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) { - hash, err := v.coordinator.HashOfKey(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, pubKey) - if err != nil { - return [32]byte{}, err - } - return hash, nil -} - -// RegisterProvingKey register VRF proving key -func (v *EthereumVRFCoordinator) RegisterProvingKey( - fee *big.Int, - oracleAddr string, - publicProvingKey [2]*big.Int, - jobID [32]byte, -) error { - _, err := v.client.Decode(v.coordinator.RegisterProvingKey(v.client.NewTXOpts(), fee, common.HexToAddress(oracleAddr), publicProvingKey, jobID)) - return err -} - -func (v *EthereumVRFConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFConsumer) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -// RequestRandomness requests VRF randomness -func (v *EthereumVRFConsumer) RequestRandomness(hash [32]byte, fee *big.Int) error { - _, err := v.client.Decode(v.consumer.TestRequestRandomness(v.client.NewTXOpts(), hash, fee)) - return err -} - -// CurrentRoundID helper roundID counter in consumer to check when all randomness requests are finished -func (v *EthereumVRFConsumer) CurrentRoundID(ctx context.Context) (*big.Int, error) { - return v.consumer.CurrentRoundID(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -// RandomnessOutput get VRF randomness output -func (v *EthereumVRFConsumer) RandomnessOutput(ctx context.Context) (*big.Int, error) { - return v.consumer.RandomnessOutput(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -// Fund sends specified currencies to the contract -func (v *EthereumVRF) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -// ProofLength returns the PROOFLENGTH call from the VRF contract -func (v *EthereumVRF) ProofLength(ctx context.Context) (*big.Int, error) { - return v.vrf.PROOFLENGTH(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func LoadVRFCoordinatorV2_5(seth *seth.Client, addr string) (VRFCoordinatorV2_5, error) { - address := common.HexToAddress(addr) - abi, err := vrf_coordinator_v2_5.VRFCoordinatorV25MetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV2_5{}, fmt.Errorf("failed to get VRFCoordinatorV2_5 ABI: %w", err) - } - seth.ContractStore.AddABI("VRFCoordinatorV2_5", *abi) - seth.ContractStore.AddBIN("VRFCoordinatorV2_5", common.FromHex(vrf_coordinator_v2_5.VRFCoordinatorV25MetaData.Bin)) - - contract, err := vrf_coordinator_v2_5.NewVRFCoordinatorV25(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorV2_5{}, fmt.Errorf("failed to instantiate VRFCoordinatorV2_5 instance: %w", err) - } - - return &EthereumVRFCoordinatorV2_5{ - client: seth, - address: address, - coordinator: contract, - }, nil -} - -func LoadBlockHashStore(seth *seth.Client, addr string) (BlockHashStore, error) { - address := common.HexToAddress(addr) - abi, err := blockhash_store.BlockhashStoreMetaData.GetAbi() - if err != nil { - return &EthereumBlockhashStore{}, fmt.Errorf("failed to get BlockHashStore ABI: %w", err) - } - seth.ContractStore.AddABI("BlockHashStore", *abi) - seth.ContractStore.AddBIN("BlockHashStore", common.FromHex(blockhash_store.BlockhashStoreMetaData.Bin)) - - contract, err := blockhash_store.NewBlockhashStore(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBlockhashStore{}, fmt.Errorf("failed to instantiate BlockHashStore instance: %w", err) - } - - return &EthereumBlockhashStore{ - client: seth, - address: &address, - blockHashStore: contract, - }, nil -} - -func LoadVRFv2PlusLoadTestConsumer(seth *seth.Client, addr string) (VRFv2PlusLoadTestConsumer, error) { - address := common.HexToAddress(addr) - abi, err := vrf_v2plus_load_test_with_metrics.VRFV2PlusLoadTestWithMetricsMetaData.GetAbi() - if err != nil { - return &EthereumVRFv2PlusLoadTestConsumer{}, fmt.Errorf("failed to get VRFV2PlusLoadTestWithMetrics ABI: %w", err) - } - seth.ContractStore.AddABI("VRFV2PlusLoadTestWithMetrics", *abi) - seth.ContractStore.AddBIN("VRFV2PlusLoadTestWithMetrics", common.FromHex(vrf_v2plus_load_test_with_metrics.VRFV2PlusLoadTestWithMetricsMetaData.Bin)) - - contract, err := vrf_v2plus_load_test_with_metrics.NewVRFV2PlusLoadTestWithMetrics(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFv2PlusLoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2PlusLoadTestWithMetrics instance: %w", err) - } - - return &EthereumVRFv2PlusLoadTestConsumer{ - client: seth, - address: address, - consumer: contract, - }, nil -} - -func LoadVRFV2PlusWrapper(seth *seth.Client, addr string) (VRFV2PlusWrapper, error) { - address := common.HexToAddress(addr) - abi, err := vrfv2plus_wrapper.VRFV2PlusWrapperMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFV2PlusWrapper ABI: %w", err) - } - seth.ContractStore.AddABI("VRFV2PlusWrapper", *abi) - seth.ContractStore.AddBIN("VRFV2PlusWrapper", common.FromHex(vrfv2plus_wrapper.VRFV2PlusWrapperMetaData.Bin)) - contract, err := vrfv2plus_wrapper.NewVRFV2PlusWrapper(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFV2PlusWrapper instance: %w", err) - } - return &EthereumVRFV2PlusWrapper{ - client: seth, - address: address, - wrapper: contract, - }, nil -} - -func LoadVRFV2WrapperLoadTestConsumer(seth *seth.Client, addr string) (*EthereumVRFV2PlusWrapperLoadTestConsumer, error) { - address := common.HexToAddress(addr) - abi, err := vrfv2plus_wrapper_load_test_consumer.VRFV2PlusWrapperLoadTestConsumerMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFV2PlusWrapperLoadTestConsumer ABI: %w", err) - } - seth.ContractStore.AddABI("VRFV2PlusWrapperLoadTestConsumer", *abi) - seth.ContractStore.AddBIN("VRFV2PlusWrapperLoadTestConsumer", common.FromHex(vrfv2plus_wrapper_load_test_consumer.VRFV2PlusWrapperLoadTestConsumerMetaData.Bin)) - contract, err := vrfv2plus_wrapper_load_test_consumer.NewVRFV2PlusWrapperLoadTestConsumer(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFV2PlusWrapperLoadTestConsumer instance: %w", err) - } - return &EthereumVRFV2PlusWrapperLoadTestConsumer{ - client: seth, - address: address, - consumer: contract, - }, nil -} diff --git a/integration-tests/contracts/ethereum_vrfv2_contracts.go b/integration-tests/contracts/ethereum_vrfv2_contracts.go deleted file mode 100644 index 958c09d0f70..00000000000 --- a/integration-tests/contracts/ethereum_vrfv2_contracts.go +++ /dev/null @@ -1,1220 +0,0 @@ -package contracts - -import ( - "context" - "encoding/hex" - "errors" - "fmt" - "math/big" - "strconv" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_mock_ethlink_aggregator" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_owner" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/batch_vrf_coordinator_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_consumer_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_load_test_with_metrics" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2_wrapper_load_test_consumer" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2_consumer_wrapper" -) - -type EthereumVRFOwner struct { - address common.Address - client *seth.Client - vrfOwner *vrf_owner.VRFOwner -} - -type EthereumVRFCoordinatorV2 struct { - address common.Address - client *seth.Client - coordinator *vrf_coordinator_v2.VRFCoordinatorV2 -} - -type EthereumBatchVRFCoordinatorV2 struct { - address common.Address - client *seth.Client - batchCoordinator *batch_vrf_coordinator_v2.BatchVRFCoordinatorV2 -} - -// EthereumVRFConsumerV2 represents VRFv2 consumer contract -type EthereumVRFConsumerV2 struct { - address common.Address - client *seth.Client - consumer *vrf_consumer_v2.VRFConsumerV2 -} - -// EthereumVRFv2Consumer represents VRFv2 consumer contract -type EthereumVRFv2Consumer struct { - address common.Address - client *seth.Client - consumer *vrf_v2_consumer_wrapper.VRFv2Consumer -} - -// EthereumVRFv2LoadTestConsumer represents VRFv2 consumer contract for performing Load Tests -type EthereumVRFv2LoadTestConsumer struct { - address common.Address - client *seth.Client - consumer *vrf_load_test_with_metrics.VRFV2LoadTestWithMetrics -} - -type EthereumVRFV2Wrapper struct { - address common.Address - client *seth.Client - wrapper *vrfv2_wrapper.VRFV2Wrapper -} - -type EthereumVRFV2WrapperLoadTestConsumer struct { - address common.Address - client *seth.Client - consumer *vrfv2_wrapper_load_test_consumer.VRFV2WrapperLoadTestConsumer -} - -type GetRequestConfig struct { - MinimumRequestConfirmations uint16 - MaxGasLimit uint32 - ProvingKeyHashes [32]byte -} - -type EthereumVRFMockETHLINKFeed struct { - client *seth.Client - feed *vrf_mock_ethlink_aggregator.VRFMockETHLINKAggregator - address common.Address -} - -func DeployVRFCoordinatorV2(seth *seth.Client, linkAddr, bhsAddr, linkEthFeedAddr string) (VRFCoordinatorV2, error) { - abi, err := vrf_coordinator_v2.VRFCoordinatorV2MetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV2{}, fmt.Errorf("failed to get VRFCoordinatorV2 ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV2", - *abi, - common.FromHex(vrf_coordinator_v2.VRFCoordinatorV2MetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(bhsAddr), - common.HexToAddress(linkEthFeedAddr)) - if err != nil { - return &EthereumVRFCoordinatorV2{}, fmt.Errorf("VRFCoordinatorV2 instance deployment have failed: %w", err) - } - - coordinator, err := vrf_coordinator_v2.NewVRFCoordinatorV2(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorV2{}, fmt.Errorf("failed to instantiate VRFCoordinatorV2 instance: %w", err) - } - - return &EthereumVRFCoordinatorV2{ - client: seth, - coordinator: coordinator, - address: coordinatorDeploymentData.Address, - }, err -} - -func LoadVRFCoordinatorV2(seth *seth.Client, address string) (*EthereumVRFCoordinatorV2, error) { - abi, err := vrf_coordinator_v2.VRFCoordinatorV2MetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV2{}, fmt.Errorf("failed to get VRFCoordinatorV2 ABI: %w", err) - } - seth.ContractStore.AddABI("VRFCoordinatorV2", *abi) - seth.ContractStore.AddBIN("VRFCoordinatorV2", common.FromHex(vrf_coordinator_v2.VRFCoordinatorV2MetaData.Bin)) - - contract, err := vrf_coordinator_v2.NewVRFCoordinatorV2(common.HexToAddress(address), wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorV2{}, fmt.Errorf("failed to instantiate VRFCoordinatorV2 instance: %w", err) - } - - return &EthereumVRFCoordinatorV2{ - client: seth, - address: common.HexToAddress(address), - coordinator: contract, - }, nil -} - -func DeployBatchVRFCoordinatorV2(seth *seth.Client, coordinatorAddress string) (BatchVRFCoordinatorV2, error) { - abi, err := batch_vrf_coordinator_v2.BatchVRFCoordinatorV2MetaData.GetAbi() - if err != nil { - return &EthereumBatchVRFCoordinatorV2{}, fmt.Errorf("failed to get BatchVRFCoordinatorV2 ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV2Plus", - *abi, - common.FromHex(batch_vrf_coordinator_v2.BatchVRFCoordinatorV2MetaData.Bin), - common.HexToAddress(coordinatorAddress)) - if err != nil { - return &EthereumBatchVRFCoordinatorV2{}, fmt.Errorf("BatchVRFCoordinatorV2 instance deployment have failed: %w", err) - } - - contract, err := batch_vrf_coordinator_v2.NewBatchVRFCoordinatorV2(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBatchVRFCoordinatorV2{}, fmt.Errorf("failed to instantiate BatchVRFCoordinatorV2 instance: %w", err) - } - - return &EthereumBatchVRFCoordinatorV2{ - client: seth, - batchCoordinator: contract, - address: coordinatorDeploymentData.Address, - }, err -} - -func (v *EthereumBatchVRFCoordinatorV2) Address() string { - return v.address.Hex() -} - -func DeployVRFOwner(seth *seth.Client, coordinatorAddress string) (VRFOwner, error) { - abi, err := vrf_owner.VRFOwnerMetaData.GetAbi() - if err != nil { - return &EthereumVRFOwner{}, fmt.Errorf("failed to get VRFOwner ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFOwner", - *abi, - common.FromHex(vrf_owner.VRFOwnerMetaData.Bin), - common.HexToAddress(coordinatorAddress)) - if err != nil { - return &EthereumVRFOwner{}, fmt.Errorf("VRFOwner instance deployment have failed: %w", err) - } - - contract, err := vrf_owner.NewVRFOwner(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFOwner{}, fmt.Errorf("failed to instantiate VRFOwner instance: %w", err) - } - - return &EthereumVRFOwner{ - client: seth, - vrfOwner: contract, - address: data.Address, - }, err -} - -// DeployVRFConsumerV2 deploys VRFv@ consumer contract -func DeployVRFConsumerV2(seth *seth.Client, linkAddr, coordinatorAddr common.Address) (VRFConsumerV2, error) { - abi, err := vrf_consumer_v2.VRFConsumerV2MetaData.GetAbi() - if err != nil { - return &EthereumVRFConsumerV2{}, fmt.Errorf("failed to get VRFConsumerV2 ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFConsumerV2", - *abi, - common.FromHex(vrf_consumer_v2.VRFConsumerV2MetaData.Bin), - coordinatorAddr, - linkAddr) - if err != nil { - return &EthereumVRFConsumerV2{}, fmt.Errorf("VRFConsumerV2 instance deployment have failed: %w", err) - } - - contract, err := vrf_consumer_v2.NewVRFConsumerV2(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFConsumerV2{}, fmt.Errorf("failed to instantiate VRFConsumerV2 instance: %w", err) - } - - return &EthereumVRFConsumerV2{ - client: seth, - consumer: contract, - address: data.Address, - }, err -} - -func DeployVRFv2Consumer(seth *seth.Client, coordinatorAddr common.Address) (VRFv2Consumer, error) { - abi, err := vrf_v2_consumer_wrapper.VRFv2ConsumerMetaData.GetAbi() - if err != nil { - return &EthereumVRFv2Consumer{}, fmt.Errorf("failed to get VRFv2Consumer ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFv2Consumer", - *abi, - common.FromHex(vrf_v2_consumer_wrapper.VRFv2ConsumerMetaData.Bin), - coordinatorAddr) - if err != nil { - return &EthereumVRFv2Consumer{}, fmt.Errorf("VRFv2Consumer instance deployment have failed: %w", err) - } - - contract, err := vrf_v2_consumer_wrapper.NewVRFv2Consumer(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFv2Consumer{}, fmt.Errorf("failed to instantiate VRFv2Consumer instance: %w", err) - } - - return &EthereumVRFv2Consumer{ - client: seth, - consumer: contract, - address: data.Address, - }, err -} - -func DeployVRFv2LoadTestConsumer(client *seth.Client, coordinatorAddr string) (VRFv2LoadTestConsumer, error) { - abi, err := vrf_load_test_with_metrics.VRFV2LoadTestWithMetricsMetaData.GetAbi() - if err != nil { - return &EthereumVRFv2LoadTestConsumer{}, fmt.Errorf("failed to get VRFV2LoadTestWithMetrics ABI: %w", err) - } - - data, err := client.DeployContract( - client.NewTXOpts(), - "VRFV2LoadTestWithMetrics", - *abi, - common.FromHex(vrf_load_test_with_metrics.VRFV2LoadTestWithMetricsMetaData.Bin), - common.HexToAddress(coordinatorAddr)) - if err != nil { - return &EthereumVRFv2LoadTestConsumer{}, fmt.Errorf("VRFV2LoadTestWithMetrics instance deployment have failed: %w", err) - } - - contract, err := vrf_load_test_with_metrics.NewVRFV2LoadTestWithMetrics(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumVRFv2LoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2LoadTestWithMetrics instance: %w", err) - } - - return &EthereumVRFv2LoadTestConsumer{ - client: client, - consumer: contract, - address: data.Address, - }, err -} - -func LoadVRFv2LoadTestConsumer(seth *seth.Client, addr common.Address) (VRFv2LoadTestConsumer, error) { - abi, err := vrf_load_test_with_metrics.VRFV2LoadTestWithMetricsMetaData.GetAbi() - if err != nil { - return &EthereumVRFv2LoadTestConsumer{}, fmt.Errorf("failed to get VRFV2LoadTestWithMetrics ABI: %w", err) - } - seth.ContractStore.AddABI("VRFV2LoadTestWithMetrics", *abi) - seth.ContractStore.AddBIN("VRFV2LoadTestWithMetrics", common.FromHex(vrf_load_test_with_metrics.VRFV2LoadTestWithMetricsMetaData.Bin)) - - contract, err := vrf_load_test_with_metrics.NewVRFV2LoadTestWithMetrics(addr, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFv2LoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2LoadTestWithMetrics instance: %w", err) - } - - return &EthereumVRFv2LoadTestConsumer{ - client: seth, - address: addr, - consumer: contract, - }, nil -} - -func DeployVRFV2Wrapper(client *seth.Client, linkAddr string, linkEthFeedAddr string, coordinatorAddr string) (VRFV2Wrapper, error) { - abi, err := vrfv2_wrapper.VRFV2WrapperMetaData.GetAbi() - if err != nil { - return &EthereumVRFV2Wrapper{}, fmt.Errorf("failed to get VRFV2Wrapper ABI: %w", err) - } - - data, err := client.DeployContract( - client.NewTXOpts(), - "VRFV2Wrapper", - *abi, - common.FromHex(vrfv2_wrapper.VRFV2WrapperMetaData.Bin), - common.HexToAddress(linkAddr), - common.HexToAddress(linkEthFeedAddr), - common.HexToAddress(coordinatorAddr)) - if err != nil { - return &EthereumVRFV2Wrapper{}, fmt.Errorf("VRFV2Wrapper instance deployment have failed: %w", err) - } - - contract, err := vrfv2_wrapper.NewVRFV2Wrapper(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumVRFV2Wrapper{}, fmt.Errorf("failed to instantiate VRFV2Wrapper instance: %w", err) - } - - return &EthereumVRFV2Wrapper{ - client: client, - wrapper: contract, - address: data.Address, - }, err -} - -func DeployVRFV2WrapperLoadTestConsumer(client *seth.Client, linkAddr string, vrfV2WrapperAddr string) (VRFv2WrapperLoadTestConsumer, error) { - abi, err := vrfv2_wrapper_load_test_consumer.VRFV2WrapperLoadTestConsumerMetaData.GetAbi() - if err != nil { - return &EthereumVRFV2WrapperLoadTestConsumer{}, fmt.Errorf("failed to get VRFV2WrapperLoadTestConsumer ABI: %w", err) - } - - data, err := client.DeployContract( - client.NewTXOpts(), - "VRFV2WrapperLoadTestConsumer", - *abi, - common.FromHex(vrfv2_wrapper_load_test_consumer.VRFV2WrapperLoadTestConsumerMetaData.Bin), - common.HexToAddress(linkAddr), common.HexToAddress(vrfV2WrapperAddr)) - if err != nil { - return &EthereumVRFV2WrapperLoadTestConsumer{}, fmt.Errorf("VRFV2WrapperLoadTestConsumer instance deployment have failed: %w", err) - } - - contract, err := vrfv2_wrapper_load_test_consumer.NewVRFV2WrapperLoadTestConsumer(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumVRFV2WrapperLoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2WrapperLoadTestConsumer instance: %w", err) - } - - return &EthereumVRFV2WrapperLoadTestConsumer{ - client: client, - consumer: contract, - address: data.Address, - }, err -} - -func (v *EthereumVRFCoordinatorV2) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFCoordinatorV2) HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - hash, err := v.coordinator.HashOfKey(opts, pubKey) - if err != nil { - return [32]byte{}, err - } - return hash, nil -} - -func (v *EthereumVRFCoordinatorV2) GetSubscription(ctx context.Context, subID uint64) (Subscription, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - subscription, err := v.coordinator.GetSubscription(opts, subID) - if err != nil { - return Subscription{}, err - } - return Subscription{ - Balance: subscription.Balance, - NativeBalance: nil, - SubOwner: subscription.Owner, - Consumers: subscription.Consumers, - ReqCount: subscription.ReqCount, - }, nil -} - -func (v *EthereumVRFCoordinatorV2) GetOwner(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - coordinatorOwnerAddress, err := v.coordinator.Owner(opts) - if err != nil { - return common.Address{}, err - } - return coordinatorOwnerAddress, nil -} - -func (v *EthereumVRFCoordinatorV2) GetRequestConfig(ctx context.Context) (GetRequestConfig, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - minConfirmations, maxGas, keyHashes, err := v.coordinator.GetRequestConfig(opts) - if err != nil { - return GetRequestConfig{}, err - } - requestConfig := GetRequestConfig{ - MinimumRequestConfirmations: minConfirmations, - MaxGasLimit: maxGas, - ProvingKeyHashes: keyHashes[0], - } - - return requestConfig, nil -} - -func (v *EthereumVRFCoordinatorV2) GetConfig(ctx context.Context) (vrf_coordinator_v2.GetConfig, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - config, err := v.coordinator.GetConfig(opts) - if err != nil { - return vrf_coordinator_v2.GetConfig{}, err - } - return config, nil -} - -func (v *EthereumVRFCoordinatorV2) GetFallbackWeiPerUnitLink(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - fallbackWeiPerUnitLink, err := v.coordinator.GetFallbackWeiPerUnitLink(opts) - if err != nil { - return nil, err - } - return fallbackWeiPerUnitLink, nil -} - -func (v *EthereumVRFCoordinatorV2) GetFeeConfig(ctx context.Context) (vrf_coordinator_v2.GetFeeConfig, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - config, err := v.coordinator.GetFeeConfig(opts) - if err != nil { - return vrf_coordinator_v2.GetFeeConfig{}, err - } - return config, nil -} - -func (v *EthereumVRFCoordinatorV2) SetConfig(minimumRequestConfirmations uint16, maxGasLimit uint32, stalenessSeconds uint32, gasAfterPaymentCalculation uint32, fallbackWeiPerUnitLink *big.Int, feeConfig vrf_coordinator_v2.VRFCoordinatorV2FeeConfig) error { - _, err := v.client.Decode(v.coordinator.SetConfig( - v.client.NewTXOpts(), - minimumRequestConfirmations, - maxGasLimit, - stalenessSeconds, - gasAfterPaymentCalculation, - fallbackWeiPerUnitLink, - feeConfig, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2) RegisterProvingKey( - oracleAddr string, - publicProvingKey [2]*big.Int, -) error { - _, err := v.client.Decode(v.coordinator.RegisterProvingKey(v.client.NewTXOpts(), - common.HexToAddress(oracleAddr), publicProvingKey)) - return err -} - -func (v *EthereumVRFCoordinatorV2) TransferOwnership(to common.Address) error { - _, err := v.client.Decode(v.coordinator.TransferOwnership(v.client.NewTXOpts(), to)) - return err -} - -func (v *EthereumVRFCoordinatorV2) CreateSubscription() (*types.Receipt, error) { - tx, err := v.client.Decode(v.coordinator.CreateSubscription(v.client.NewTXOpts())) - return tx.Receipt, err -} - -func (v *EthereumVRFCoordinatorV2) AddConsumer(subId uint64, consumerAddress string) error { - _, err := v.client.Decode(v.coordinator.AddConsumer( - v.client.NewTXOpts(), - subId, - common.HexToAddress(consumerAddress), - )) - return err -} - -func (v *EthereumVRFCoordinatorV2) PendingRequestsExist(ctx context.Context, subID uint64) (bool, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - pendingRequestExists, err := v.coordinator.PendingRequestExists(opts, subID) - if err != nil { - return false, err - } - return pendingRequestExists, nil -} - -func (v *EthereumVRFCoordinatorV2) OracleWithdraw(recipient common.Address, amount *big.Int) error { - _, err := v.client.Decode(v.coordinator.OracleWithdraw(v.client.NewTXOpts(), recipient, amount)) - return err -} - -// OwnerCancelSubscription cancels subscription, -// return funds to the subscription owner, -// down not check if pending requests for a sub exist, -// outstanding requests may fail onchain -func (v *EthereumVRFCoordinatorV2) OwnerCancelSubscription(subID uint64) (*seth.DecodedTransaction, *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) { - tx, err := v.client.Decode(v.coordinator.OwnerCancelSubscription( - v.client.NewTXOpts(), - subID, - )) - if err != nil { - return nil, nil, err - } - var subCanceledEvent *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled - for _, log := range tx.Receipt.Logs { - for _, topic := range log.Topics { - if topic.Cmp(vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled{}.Topic()) == 0 { - subCanceledEvent, err = v.coordinator.ParseSubscriptionCanceled(*log) - if err != nil { - return nil, nil, fmt.Errorf("parsing SubscriptionCanceled log failed, err: %w", err) - } - } - } - } - return tx, subCanceledEvent, err -} - -func (v *EthereumVRFCoordinatorV2) ParseSubscriptionCanceled(log types.Log) (*vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) { - return v.coordinator.ParseSubscriptionCanceled(log) -} - -func (v *EthereumVRFCoordinatorV2) ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) { - requested, err := v.coordinator.ParseRandomWordsRequested(log) - if err != nil { - return nil, fmt.Errorf("failed to parse RandomWordsRequested event: %w", err) - } - - return &CoordinatorRandomWordsRequested{ - KeyHash: requested.KeyHash, - RequestId: requested.RequestId, - PreSeed: requested.PreSeed, - SubId: strconv.FormatUint(requested.SubId, 10), - MinimumRequestConfirmations: requested.MinimumRequestConfirmations, - CallbackGasLimit: requested.CallbackGasLimit, - NumWords: requested.NumWords, - Sender: requested.Sender, - ExtraArgs: nil, - Raw: requested.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2) ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) { - fulfilled, err := v.coordinator.ParseRandomWordsFulfilled(log) - if err != nil { - return nil, fmt.Errorf("failed to parse RandomWordsFulfilled event: %w", err) - } - - return &CoordinatorRandomWordsFulfilled{ - RequestId: fulfilled.RequestId, - OutputSeed: fulfilled.OutputSeed, - Payment: fulfilled.Payment, - Success: fulfilled.Success, - Raw: fulfilled.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2) ParseLog(log types.Log) (generated.AbigenLog, error) { - return v.coordinator.ParseLog(log) -} - -func (v *EthereumVRFCoordinatorV2) GetLinkAddress(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - address, err := v.coordinator.LINK(opts) - if err != nil { - return common.Address{}, err - } - return address, nil -} - -func (v *EthereumVRFCoordinatorV2) GetLinkNativeFeed(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - address, err := v.coordinator.LINKETHFEED(opts) - if err != nil { - return common.Address{}, err - } - return address, nil -} - -// CancelSubscription cancels subscription by Sub owner, -// return funds to specified address, -// checks if pending requests for a sub exist -func (v *EthereumVRFCoordinatorV2) CancelSubscription(subID uint64, to common.Address) (*seth.DecodedTransaction, *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled, error) { - tx, err := v.client.Decode(v.coordinator.CancelSubscription( - v.client.NewTXOpts(), - subID, - to, - )) - if err != nil { - return nil, nil, err - } - var subCanceledEvent *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled - for _, log := range tx.Receipt.Logs { - for _, topic := range log.Topics { - if topic.Cmp(vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCanceled{}.Topic()) == 0 { - subCanceledEvent, err = v.coordinator.ParseSubscriptionCanceled(*log) - if err != nil { - return nil, nil, fmt.Errorf("parsing SubscriptionCanceled log failed, err: %w", err) - } - } - } - } - return tx, subCanceledEvent, err -} - -func (v *EthereumVRFCoordinatorV2) FindSubscriptionID(subID uint64) (uint64, error) { - owner := v.client.MustGetRootKeyAddress() - subscriptionIterator, err := v.coordinator.FilterSubscriptionCreated( - nil, - []uint64{subID}, - ) - if err != nil { - return 0, err - } - if !subscriptionIterator.Next() { - return 0, fmt.Errorf("expected at least 1 subID for the given owner %s", owner) - } - return subscriptionIterator.Event.SubId, nil -} - -func (v *EthereumVRFCoordinatorV2) GetBlockHashStoreAddress(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - blockHashStoreAddress, err := v.coordinator.BLOCKHASHSTORE(opts) - if err != nil { - return common.Address{}, err - } - return blockHashStoreAddress, nil -} - -func (v *EthereumVRFCoordinatorV2) FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) { - iterator, err := v.coordinator.FilterRandomWordsFulfilled( - opts, - []*big.Int{requestId}, - ) - if err != nil { - return nil, err - } - if !iterator.Next() { - return nil, fmt.Errorf("expected at least 1 RandomWordsFulfilled event for request Id: %s", requestId.String()) - } - return &CoordinatorRandomWordsFulfilled{ - RequestId: iterator.Event.RequestId, - OutputSeed: iterator.Event.OutputSeed, - Payment: iterator.Event.Payment, - Success: iterator.Event.Success, - Raw: iterator.Event.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2) WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) { - randomWordsFulfilledEventsChannel := make(chan *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsFulfilled) - subscription, err := v.coordinator.WatchRandomWordsFulfilled(nil, randomWordsFulfilledEventsChannel, filter.RequestIds) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(filter.Timeout): - return nil, errors.New("timeout waiting for RandomWordsFulfilled event") - case randomWordsFulfilledEvent := <-randomWordsFulfilledEventsChannel: - return &CoordinatorRandomWordsFulfilled{ - RequestId: randomWordsFulfilledEvent.RequestId, - OutputSeed: randomWordsFulfilledEvent.OutputSeed, - Payment: randomWordsFulfilledEvent.Payment, - Success: randomWordsFulfilledEvent.Success, - Raw: randomWordsFulfilledEvent.Raw, - }, nil - } - } -} - -func (v *EthereumVRFCoordinatorV2) WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) { - eventsChannel := make(chan *vrf_coordinator_v2.VRFCoordinatorV2ConfigSet) - subscription, err := v.coordinator.WatchConfigSet(nil, eventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, errors.New("timeout waiting for ConfigSet event") - case event := <-eventsChannel: - return &CoordinatorConfigSet{ - MinimumRequestConfirmations: event.MinimumRequestConfirmations, - MaxGasLimit: event.MaxGasLimit, - StalenessSeconds: event.StalenessSeconds, - GasAfterPaymentCalculation: event.GasAfterPaymentCalculation, - FallbackWeiPerUnitLink: event.FallbackWeiPerUnitLink, - FeeConfig: VRFCoordinatorV2FeeConfig{ - FulfillmentFlatFeeLinkPPMTier1: event.FeeConfig.FulfillmentFlatFeeLinkPPMTier1, - FulfillmentFlatFeeLinkPPMTier2: event.FeeConfig.FulfillmentFlatFeeLinkPPMTier2, - FulfillmentFlatFeeLinkPPMTier3: event.FeeConfig.FulfillmentFlatFeeLinkPPMTier3, - FulfillmentFlatFeeLinkPPMTier4: event.FeeConfig.FulfillmentFlatFeeLinkPPMTier4, - FulfillmentFlatFeeLinkPPMTier5: event.FeeConfig.FulfillmentFlatFeeLinkPPMTier5, - ReqsForTier2: event.FeeConfig.ReqsForTier2, - ReqsForTier3: event.FeeConfig.ReqsForTier3, - ReqsForTier4: event.FeeConfig.ReqsForTier4, - ReqsForTier5: event.FeeConfig.ReqsForTier5, - }, - }, nil - } - } -} - -// GetAllRandomWords get all VRFv2 randomness output words -func (v *EthereumVRFConsumerV2) GetAllRandomWords(ctx context.Context, num int) ([]*big.Int, error) { - words := make([]*big.Int, 0) - for i := range num { - word, err := v.consumer.SRandomWords(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, big.NewInt(int64(i))) - if err != nil { - return nil, err - } - words = append(words, word) - } - return words, nil -} - -// LoadExistingConsumer loads an EthereumVRFConsumerV2 with a specified address -func (v *EthereumVRFConsumerV2) LoadExistingConsumer(seth *seth.Client, address common.Address) error { - abi, err := vrf_consumer_v2.VRFConsumerV2MetaData.GetAbi() - if err != nil { - return fmt.Errorf("failed to get VRFConsumerV2 ABI: %w", err) - } - seth.ContractStore.AddABI("VRFConsumerV2", *abi) - seth.ContractStore.AddBIN("VRFConsumerV2", common.FromHex(vrf_consumer_v2.VRFConsumerV2MetaData.Bin)) - - contract, err := vrf_consumer_v2.NewVRFConsumerV2(address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return fmt.Errorf("failed to instantiate VRFConsumerV2 instance: %w", err) - } - - v.client = seth - v.consumer = contract - v.address = address - - return nil -} - -// CreateFundedSubscription create funded subscription for VRFv2 randomness -func (v *EthereumVRFConsumerV2) CreateFundedSubscription(funds *big.Int) error { - _, err := v.client.Decode(v.consumer.CreateSubscriptionAndFund(v.client.NewTXOpts(), funds)) - return err -} - -// TopUpSubscriptionFunds add funds to a VRFv2 subscription -func (v *EthereumVRFConsumerV2) TopUpSubscriptionFunds(funds *big.Int) error { - _, err := v.client.Decode(v.consumer.TopUpSubscription(v.client.NewTXOpts(), funds)) - return err -} - -func (v *EthereumVRFConsumerV2) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFv2Consumer) Address() string { - return v.address.Hex() -} - -// CurrentSubscription get current VRFv2 subscription -func (v *EthereumVRFConsumerV2) CurrentSubscription() (uint64, error) { - return v.consumer.SSubId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: context.Background(), - }) -} - -// GasAvailable get available gas after randomness fulfilled -func (v *EthereumVRFConsumerV2) GasAvailable() (*big.Int, error) { - return v.consumer.SGasAvailable(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: context.Background(), - }) -} - -func (v *EthereumVRFConsumerV2) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -// RequestRandomness request VRFv2 random words -func (v *EthereumVRFConsumerV2) RequestRandomness(hash [32]byte, subID uint64, confs uint16, gasLimit uint32, numWords uint32) error { - _, err := v.client.Decode(v.consumer.RequestRandomness(v.client.NewTXOpts(), hash, subID, confs, gasLimit, numWords)) - if err != nil { - return err - } - log.Info().Interface("Sub ID", subID). - Interface("Number of Words", numWords). - Interface("Number of Confirmations", confs). - Interface("Callback Gas Limit", gasLimit). - Interface("KeyHash", hex.EncodeToString(hash[:])). - Interface("Consumer Contract", v.address). - Msg("RequestRandomness called") - return nil -} - -// RequestRandomness request VRFv2 random words -func (v *EthereumVRFv2Consumer) RequestRandomness(hash [32]byte, subID uint64, confs uint16, gasLimit uint32, numWords uint32) error { - _, err := v.client.Decode(v.consumer.RequestRandomWords(v.client.NewTXOpts(), subID, gasLimit, confs, numWords, hash)) - if err != nil { - return err - } - log.Info().Interface("Sub ID", subID). - Interface("Number of Words", numWords). - Interface("Number of Confirmations", confs). - Interface("Callback Gas Limit", gasLimit). - Interface("KeyHash", hex.EncodeToString(hash[:])). - Interface("Consumer Contract", v.address). - Msg("RequestRandomness called") - return nil -} - -// RandomnessOutput get VRFv2 randomness output (word) -func (v *EthereumVRFConsumerV2) RandomnessOutput(ctx context.Context, arg0 *big.Int) (*big.Int, error) { - return v.consumer.SRandomWords(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, arg0) -} - -func (v *EthereumVRFv2LoadTestConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFv2LoadTestConsumer) RequestRandomness( - coordinator Coordinator, - keyHash [32]byte, - subID uint64, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, -) (*CoordinatorRandomWordsRequested, error) { - return v.RequestRandomnessFromKey(coordinator, keyHash, subID, requestConfirmations, callbackGasLimit, numWords, requestCount, 0) -} - -func (v *EthereumVRFv2LoadTestConsumer) RequestRandomnessFromKey( - coordinator Coordinator, - keyHash [32]byte, - subID uint64, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - keyNum int, -) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.RequestRandomWords(v.client.NewTXKeyOpts(keyNum), subID, requestConfirmations, keyHash, callbackGasLimit, numWords, requestCount)) - if err != nil { - return nil, fmt.Errorf("RequestRandomWords failed, err: %w", err) - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFv2LoadTestConsumer) RequestRandomWordsWithForceFulfill( - coordinator Coordinator, - keyHash [32]byte, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, - subTopUpAmount *big.Int, - linkAddress common.Address, -) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.RequestRandomWordsWithForceFulfill( - v.client.NewTXOpts(), - requestConfirmations, - keyHash, - callbackGasLimit, - numWords, - requestCount, - subTopUpAmount, - linkAddress, - )) - if err != nil { - return nil, fmt.Errorf("RequestRandomWords failed, err: %w", err) - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFv2Consumer) GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_v2_consumer_wrapper.GetRequestStatus, error) { - return v.consumer.GetRequestStatus(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, requestID) -} - -func (v *EthereumVRFv2Consumer) GetLastRequestId(ctx context.Context) (*big.Int, error) { - return v.consumer.LastRequestId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFv2LoadTestConsumer) GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_load_test_with_metrics.GetRequestStatus, error) { - return v.consumer.GetRequestStatus(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, requestID) -} - -func (v *EthereumVRFv2LoadTestConsumer) GetLastRequestId(ctx context.Context) (*big.Int, error) { - return v.consumer.SLastRequestId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFv2LoadTestConsumer) ResetMetrics() error { - _, err := v.client.Decode(v.consumer.Reset(v.client.NewTXOpts())) - return err -} - -func (v *EthereumVRFv2LoadTestConsumer) GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) { - requestCount, err := v.consumer.SRequestCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return &VRFLoadTestMetrics{}, err - } - fulfilmentCount, err := v.consumer.SResponseCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return &VRFLoadTestMetrics{}, err - } - averageFulfillmentInMillions, err := v.consumer.SAverageFulfillmentInMillions(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return &VRFLoadTestMetrics{}, err - } - slowestFulfillment, err := v.consumer.SSlowestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return &VRFLoadTestMetrics{}, err - } - fastestFulfillment, err := v.consumer.SFastestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return &VRFLoadTestMetrics{}, err - } - - return &VRFLoadTestMetrics{ - RequestCount: requestCount, - FulfilmentCount: fulfilmentCount, - AverageFulfillmentInMillions: averageFulfillmentInMillions, - SlowestFulfillment: slowestFulfillment, - FastestFulfillment: fastestFulfillment, - P90FulfillmentBlockTime: 0.0, - P95FulfillmentBlockTime: 0.0, - AverageResponseTimeInSecondsMillions: nil, - SlowestResponseTimeInSeconds: nil, - FastestResponseTimeInSeconds: nil, - }, nil -} - -func (v *EthereumVRFV2Wrapper) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFV2Wrapper) SetConfig(wrapperGasOverhead uint32, coordinatorGasOverhead uint32, wrapperPremiumPercentage uint8, keyHash [32]byte, maxNumWords uint8) error { - _, err := v.client.Decode(v.wrapper.SetConfig( - v.client.NewTXOpts(), - wrapperGasOverhead, - coordinatorGasOverhead, - wrapperPremiumPercentage, - keyHash, - maxNumWords, - )) - return err -} - -func (v *EthereumVRFV2Wrapper) GetSubID(ctx context.Context) (uint64, error) { - return v.wrapper.SUBSCRIPTIONID(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) RequestRandomness(coordinator Coordinator, requestConfirmations uint16, callbackGasLimit uint32, numWords uint32, requestCount uint16) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.MakeRequests(v.client.NewTXOpts(), - callbackGasLimit, requestConfirmations, numWords, requestCount)) - if err != nil { - return nil, err - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) GetRequestStatus(ctx context.Context, requestID *big.Int) (vrfv2_wrapper_load_test_consumer.GetRequestStatus, error) { - return v.consumer.GetRequestStatus(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, requestID) -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) GetLastRequestId(ctx context.Context) (*big.Int, error) { - return v.consumer.SLastRequestId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) GetWrapper(ctx context.Context) (common.Address, error) { - return v.consumer.IVrfV2Wrapper(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2WrapperLoadTestConsumer) GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) { - requestCount, err := v.consumer.SRequestCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - fulfilmentCount, err := v.consumer.SResponseCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - averageFulfillmentInMillions, err := v.consumer.SAverageFulfillmentInMillions(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - slowestFulfillment, err := v.consumer.SSlowestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - fastestFulfillment, err := v.consumer.SFastestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - - return &VRFLoadTestMetrics{ - RequestCount: requestCount, - FulfilmentCount: fulfilmentCount, - AverageFulfillmentInMillions: averageFulfillmentInMillions, - SlowestFulfillment: slowestFulfillment, - FastestFulfillment: fastestFulfillment, - P90FulfillmentBlockTime: 0.0, - P95FulfillmentBlockTime: 0.0, - AverageResponseTimeInSecondsMillions: nil, - SlowestResponseTimeInSeconds: nil, - FastestResponseTimeInSeconds: nil, - }, nil -} - -func (v *EthereumVRFOwner) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFOwner) SetAuthorizedSenders(senders []common.Address) error { - _, err := v.client.Decode(v.vrfOwner.SetAuthorizedSenders( - v.client.NewTXOpts(), - senders, - )) - return err -} - -func (v *EthereumVRFOwner) AcceptVRFOwnership() error { - _, err := v.client.Decode(v.vrfOwner.AcceptVRFOwnership(v.client.NewTXOpts())) - return err -} - -func (v *EthereumVRFOwner) WaitForRandomWordsForcedEvent(requestIDs []*big.Int, subIds []uint64, senders []common.Address, timeout time.Duration) (*vrf_owner.VRFOwnerRandomWordsForced, error) { - eventsChannel := make(chan *vrf_owner.VRFOwnerRandomWordsForced) - subscription, err := v.vrfOwner.WatchRandomWordsForced(nil, eventsChannel, requestIDs, subIds, senders) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, errors.New("timeout waiting for RandomWordsForced event") - case event := <-eventsChannel: - return event, nil - } - } -} - -func (v *EthereumVRFOwner) OwnerCancelSubscription(subID uint64) (*types.Transaction, error) { - // Do not wrap in Decode() to avoid waiting until the transaction is mined - return v.vrfOwner.OwnerCancelSubscription( - v.client.NewTXOpts(), - subID, - ) -} - -func (v *EthereumVRFMockETHLINKFeed) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFMockETHLINKFeed) LatestRoundData() (*big.Int, error) { - data, err := v.feed.LatestRoundData(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.Ans, nil -} - -func (v *EthereumVRFMockETHLINKFeed) LatestRoundDataUpdatedAt() (*big.Int, error) { - data, err := v.feed.LatestRoundData(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: context.Background(), - }) - if err != nil { - return nil, err - } - return data.UpdatedAt, nil -} - -func (v *EthereumVRFMockETHLINKFeed) SetBlockTimestampDeduction(blockTimestampDeduction *big.Int) error { - _, err := v.client.Decode(v.feed.SetBlockTimestampDeduction(v.client.NewTXOpts(), blockTimestampDeduction)) - return err -} diff --git a/integration-tests/contracts/ethereum_vrfv2plus_contracts.go b/integration-tests/contracts/ethereum_vrfv2plus_contracts.go deleted file mode 100644 index 7292030a80b..00000000000 --- a/integration-tests/contracts/ethereum_vrfv2plus_contracts.go +++ /dev/null @@ -1,1469 +0,0 @@ -package contracts - -import ( - "context" - "errors" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/montanaflynn/stats" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/batch_blockhash_store" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/batch_vrf_coordinator_v2plus" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_test_v2_5" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5_arbitrum" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_coordinator_v2_5_optimism" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_load_test_with_metrics" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrf_v2plus_upgraded_version" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_arbitrum" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_load_test_consumer" - "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/vrfv2plus_wrapper_optimism" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" -) - -type EthereumVRFCoordinatorV2_5 struct { - address common.Address - client *seth.Client - coordinator vrf_coordinator_v2_5.VRFCoordinatorV25Interface -} - -type EthereumVRFCoordinatorV2_5_Optimism struct { - Address common.Address - client *seth.Client - coordinator vrf_coordinator_v2_5_optimism.VRFCoordinatorV25Optimism -} - -type EthereumVRFCoordinatorV2_5_Arbitrum struct { - Address common.Address - client *seth.Client - coordinator vrf_coordinator_v2_5_arbitrum.VRFCoordinatorV25Arbitrum -} - -type EthereumVRFCoordinatorTestV2_5 struct { - Address common.Address - client *seth.Client - coordinator vrf_coordinator_test_v2_5.VRFCoordinatorTestV25 -} - -type EthereumBatchVRFCoordinatorV2Plus struct { - address common.Address - client *seth.Client - batchCoordinator *batch_vrf_coordinator_v2plus.BatchVRFCoordinatorV2Plus -} - -type EthereumVRFCoordinatorV2PlusUpgradedVersion struct { - address common.Address - client *seth.Client - coordinator *vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersion -} - -// EthereumVRFv2PlusLoadTestConsumer represents VRFv2Plus consumer contract for performing Load Tests -type EthereumVRFv2PlusLoadTestConsumer struct { - address common.Address - client *seth.Client - consumer *vrf_v2plus_load_test_with_metrics.VRFV2PlusLoadTestWithMetrics -} - -type EthereumVRFV2PlusWrapperLoadTestConsumer struct { - address common.Address - client *seth.Client - consumer *vrfv2plus_wrapper_load_test_consumer.VRFV2PlusWrapperLoadTestConsumer -} - -type EthereumVRFV2PlusWrapper struct { - address common.Address - client *seth.Client - wrapper *vrfv2plus_wrapper.VRFV2PlusWrapper -} - -type EthereumVRFV2PlusWrapperOptimism struct { - Address common.Address - client *seth.Client - wrapper *vrfv2plus_wrapper_optimism.VRFV2PlusWrapperOptimism -} - -type EthereumVRFV2PlusWrapperArbitrum struct { - Address common.Address - client *seth.Client - wrapper *vrfv2plus_wrapper_arbitrum.VRFV2PlusWrapperArbitrum -} - -func (v *EthereumVRFV2PlusWrapper) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFV2PlusWrapper) SetConfig(wrapperGasOverhead uint32, - coordinatorGasOverheadNative uint32, - coordinatorGasOverheadLink uint32, - coordinatorGasOverheadPerWord uint16, - wrapperNativePremiumPercentage uint8, - wrapperLinkPremiumPercentage uint8, - keyHash [32]byte, - maxNumWords uint8, - stalenessSeconds uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, -) error { - _, err := v.client.Decode(v.wrapper.SetConfig( - v.client.NewTXOpts(), - wrapperGasOverhead, - coordinatorGasOverheadNative, - coordinatorGasOverheadLink, - coordinatorGasOverheadPerWord, - wrapperNativePremiumPercentage, - wrapperLinkPremiumPercentage, - keyHash, - maxNumWords, - stalenessSeconds, - fallbackWeiPerUnitLink, - fulfillmentFlatFeeNativePPM, - fulfillmentFlatFeeLinkDiscountPPM, - )) - return err -} - -func (v *EthereumVRFV2PlusWrapper) GetSubID(ctx context.Context) (*big.Int, error) { - return v.wrapper.SUBSCRIPTIONID(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2PlusWrapper) Coordinator(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - return v.wrapper.SVrfCoordinator(opts) -} - -// DeployVRFCoordinatorV2_5 deploys VRFV2_5 coordinator contract -func DeployVRFCoordinatorV2_5(seth *seth.Client, bhsAddr string) (VRFCoordinatorV2_5, error) { - abi, err := vrf_coordinator_v2_5.VRFCoordinatorV25MetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV2_5{}, fmt.Errorf("failed to get VRFCoordinatorV2_5 ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV2_5", - *abi, - common.FromHex(vrf_coordinator_v2_5.VRFCoordinatorV25MetaData.Bin), - common.HexToAddress(bhsAddr)) - if err != nil { - return &EthereumVRFCoordinatorV2_5{}, fmt.Errorf("VRFCoordinatorV2_5 instance deployment have failed: %w", err) - } - - contract, err := vrf_coordinator_v2_5.NewVRFCoordinatorV25(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFCoordinatorV2_5{}, fmt.Errorf("failed to instantiate VRFCoordinatorV2_5 instance: %w", err) - } - - return &EthereumVRFCoordinatorV2_5{ - client: seth, - coordinator: contract, - address: coordinatorDeploymentData.Address, - }, err -} - -func DeployVRFCoordinatorV2_5_Optimism(seth *seth.Client, bhsAddr string) (*EthereumVRFCoordinatorV2_5_Optimism, error) { - abi, err := vrf_coordinator_v2_5_optimism.VRFCoordinatorV25OptimismMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFCoordinatorV2_5_Optimism ABI: %w", err) - } - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV2_5_Optimism", - *abi, - common.FromHex(vrf_coordinator_v2_5_optimism.VRFCoordinatorV25OptimismMetaData.Bin), - common.HexToAddress(bhsAddr)) - if err != nil { - return nil, fmt.Errorf("VRFCoordinatorV2_5_Optimism instance deployment have failed: %w", err) - } - contract, err := vrf_coordinator_v2_5_optimism.NewVRFCoordinatorV25Optimism(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFCoordinatorV2_5_Optimism instance: %w", err) - } - return &EthereumVRFCoordinatorV2_5_Optimism{ - client: seth, - coordinator: *contract, - Address: coordinatorDeploymentData.Address, - }, err -} - -func DeployVRFCoordinatorV2_5_Arbitrum(seth *seth.Client, bhsAddr string) (*EthereumVRFCoordinatorV2_5_Arbitrum, error) { - abi, err := vrf_coordinator_v2_5_arbitrum.VRFCoordinatorV25ArbitrumMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFCoordinatorV2_5_Arbitrum ABI: %w", err) - } - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorV2_5_Arbitrum", - *abi, - common.FromHex(vrf_coordinator_v2_5_arbitrum.VRFCoordinatorV25ArbitrumMetaData.Bin), - common.HexToAddress(bhsAddr)) - if err != nil { - return nil, fmt.Errorf("VRFCoordinatorV2_5_Arbitrum instance deployment have failed: %w", err) - } - contract, err := vrf_coordinator_v2_5_arbitrum.NewVRFCoordinatorV25Arbitrum(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFCoordinatorV2_5_Arbitrum instance: %w", err) - } - return &EthereumVRFCoordinatorV2_5_Arbitrum{ - client: seth, - coordinator: *contract, - Address: coordinatorDeploymentData.Address, - }, err -} - -func DeployVRFCoordinatorTestV2_5(seth *seth.Client, bhsAddr string) (*EthereumVRFCoordinatorTestV2_5, error) { - abi, err := vrf_coordinator_test_v2_5.VRFCoordinatorTestV25MetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFCoordinatorTestV2_5 ABI: %w", err) - } - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFCoordinatorTestV2_5", - *abi, - common.FromHex(vrf_coordinator_test_v2_5.VRFCoordinatorTestV25MetaData.Bin), - common.HexToAddress(bhsAddr)) - if err != nil { - return nil, fmt.Errorf("VRFCoordinatorTestV2_5 instance deployment have failed: %w", err) - } - contract, err := vrf_coordinator_test_v2_5.NewVRFCoordinatorTestV25(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFCoordinatorTestV2_5 instance: %w", err) - } - return &EthereumVRFCoordinatorTestV2_5{ - client: seth, - coordinator: *contract, - Address: coordinatorDeploymentData.Address, - }, err -} - -func DeployBatchVRFCoordinatorV2Plus(seth *seth.Client, coordinatorAddress string) (BatchVRFCoordinatorV2Plus, error) { - abi, err := batch_vrf_coordinator_v2plus.BatchVRFCoordinatorV2PlusMetaData.GetAbi() - if err != nil { - return &EthereumBatchVRFCoordinatorV2Plus{}, fmt.Errorf("failed to get BatchVRFCoordinatorV2Plus ABI: %w", err) - } - - coordinatorDeploymentData, err := seth.DeployContract( - seth.NewTXOpts(), - "BatchVRFCoordinatorV2Plus", - *abi, - common.FromHex(batch_vrf_coordinator_v2plus.BatchVRFCoordinatorV2PlusMetaData.Bin), - common.HexToAddress(coordinatorAddress)) - if err != nil { - return &EthereumBatchVRFCoordinatorV2Plus{}, fmt.Errorf("BatchVRFCoordinatorV2Plus instance deployment have failed: %w", err) - } - - contract, err := batch_vrf_coordinator_v2plus.NewBatchVRFCoordinatorV2Plus(coordinatorDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBatchVRFCoordinatorV2Plus{}, fmt.Errorf("failed to instantiate BatchVRFCoordinatorV2Plus instance: %w", err) - } - - return &EthereumBatchVRFCoordinatorV2Plus{ - client: seth, - batchCoordinator: contract, - address: coordinatorDeploymentData.Address, - }, err -} - -func (v *EthereumVRFCoordinatorV2_5) Address() string { - return v.address.Hex() -} - -func (v *EthereumBatchVRFCoordinatorV2Plus) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFCoordinatorV2_5) HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - hash, err := v.coordinator.HashOfKey(opts, pubKey) - if err != nil { - return [32]byte{}, err - } - return hash, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetActiveSubscriptionIds(ctx context.Context, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - activeSubscriptionIds, err := v.coordinator.GetActiveSubscriptionIds(opts, startIndex, maxCount) - if err != nil { - return nil, err - } - return activeSubscriptionIds, nil -} - -func (v *EthereumVRFCoordinatorV2_5) PendingRequestsExist(ctx context.Context, subID *big.Int) (bool, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - pendingRequestExists, err := v.coordinator.PendingRequestExists(opts, subID) - if err != nil { - return false, err - } - return pendingRequestExists, nil -} - -func (v *EthereumVRFCoordinatorV2_5) ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) { - randomWordsRequested, err := v.coordinator.ParseRandomWordsRequested(log) - if err != nil { - return nil, fmt.Errorf("parse RandomWordsRequested log failed, err: %w", err) - } - coordinatorRandomWordsRequested := &CoordinatorRandomWordsRequested{ - KeyHash: randomWordsRequested.KeyHash, - RequestId: randomWordsRequested.RequestId, - PreSeed: randomWordsRequested.PreSeed, - SubId: randomWordsRequested.SubId.String(), - MinimumRequestConfirmations: randomWordsRequested.MinimumRequestConfirmations, - CallbackGasLimit: randomWordsRequested.CallbackGasLimit, - NumWords: randomWordsRequested.NumWords, - ExtraArgs: randomWordsRequested.ExtraArgs, - Sender: randomWordsRequested.Sender, - Raw: randomWordsRequested.Raw, - } - return coordinatorRandomWordsRequested, nil -} - -func (v *EthereumVRFCoordinatorV2_5) ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) { - fulfilled, err := v.coordinator.ParseRandomWordsFulfilled(log) - if err != nil { - return nil, fmt.Errorf("failed to parse RandomWordsFulfilled event: %w", err) - } - return &CoordinatorRandomWordsFulfilled{ - RequestId: fulfilled.RequestId, - OutputSeed: fulfilled.OutputSeed, - Payment: fulfilled.Payment, - SubId: fulfilled.SubId.String(), - NativePayment: fulfilled.NativePayment, - OnlyPremium: fulfilled.OnlyPremium, - Success: fulfilled.Success, - Raw: fulfilled.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetSubscription(ctx context.Context, subID *big.Int) (Subscription, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - subscription, err := v.coordinator.GetSubscription(opts, subID) - if err != nil { - return Subscription{}, err - } - return Subscription{ - Balance: subscription.Balance, - NativeBalance: subscription.NativeBalance, - SubOwner: subscription.SubOwner, - Consumers: subscription.Consumers, - ReqCount: subscription.ReqCount, - }, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetLinkTotalBalance(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - totalBalance, err := v.coordinator.STotalBalance(opts) - if err != nil { - return nil, err - } - return totalBalance, nil -} -func (v *EthereumVRFCoordinatorV2_5) GetNativeTokenTotalBalance(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - totalBalance, err := v.coordinator.STotalNativeBalance(opts) - if err != nil { - return nil, err - } - return totalBalance, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetBlockHashStoreAddress(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - blockHashStoreAddress, err := v.coordinator.BLOCKHASHSTORE(opts) - if err != nil { - return common.Address{}, err - } - return blockHashStoreAddress, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetLinkAddress(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - address, err := v.coordinator.LINK(opts) - if err != nil { - return common.Address{}, err - } - return address, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetLinkNativeFeed(ctx context.Context) (common.Address, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - address, err := v.coordinator.LINKNATIVEFEED(opts) - if err != nil { - return common.Address{}, err - } - return address, nil -} - -func (v *EthereumVRFCoordinatorV2_5) GetConfig(ctx context.Context) (vrf_coordinator_v2_5.SConfig, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - config, err := v.coordinator.SConfig(opts) - if err != nil { - return vrf_coordinator_v2_5.SConfig{}, err - } - return config, nil -} - -// OwnerCancelSubscription cancels subscription by Coordinator owner -// return funds to sub owner, -// does not check if pending requests for a sub exist -func (v *EthereumVRFCoordinatorV2_5) OwnerCancelSubscription(subID *big.Int) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled, error) { - tx, err := v.client.Decode(v.coordinator.OwnerCancelSubscription( - v.client.NewTXOpts(), - subID, - )) - if err != nil { - return nil, nil, err - } - var cancelEvent *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled - for _, log := range tx.Receipt.Logs { - for _, topic := range log.Topics { - if topic.Cmp(vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled{}.Topic()) == 0 { - cancelEvent, err = v.coordinator.ParseSubscriptionCanceled(*log) - if err != nil { - return nil, nil, fmt.Errorf("parsing SubscriptionCanceled log failed, err: %w", err) - } - } - } - } - return tx, cancelEvent, err -} - -// CancelSubscription cancels subscription by Sub owner, -// return funds to specified address, -// checks if pending requests for a sub exist -func (v *EthereumVRFCoordinatorV2_5) CancelSubscription(subID *big.Int, to common.Address) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled, error) { - tx, err := v.client.Decode(v.coordinator.CancelSubscription( - v.client.NewTXOpts(), - subID, - to, - )) - if err != nil { - return nil, nil, err - } - var cancelEvent *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled - for _, log := range tx.Receipt.Logs { - for _, topic := range log.Topics { - if topic.Cmp(vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCanceled{}.Topic()) == 0 { - cancelEvent, err = v.coordinator.ParseSubscriptionCanceled(*log) - if err != nil { - return nil, nil, fmt.Errorf("parsing SubscriptionCanceled log failed, err: %w", err) - } - } - } - } - return tx, cancelEvent, err -} - -func (v *EthereumVRFCoordinatorV2_5) Withdraw(recipient common.Address) error { - _, err := v.client.Decode(v.coordinator.Withdraw( - v.client.NewTXOpts(), - recipient, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) WithdrawNative(recipient common.Address) error { - _, err := v.client.Decode(v.coordinator.WithdrawNative( - v.client.NewTXOpts(), - recipient, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) SetConfig( - minimumRequestConfirmations uint16, - maxGasLimit uint32, - stalenessSeconds uint32, - gasAfterPaymentCalculation uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, - nativePremiumPercentage uint8, - linkPremiumPercentage uint8) error { - _, err := v.client.Decode(v.coordinator.SetConfig( - v.client.NewTXOpts(), - minimumRequestConfirmations, - maxGasLimit, - stalenessSeconds, - gasAfterPaymentCalculation, - fallbackWeiPerUnitLink, - fulfillmentFlatFeeNativePPM, - fulfillmentFlatFeeLinkDiscountPPM, - nativePremiumPercentage, - linkPremiumPercentage, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) SetLINKAndLINKNativeFeed(linkAddress string, linkNativeFeedAddress string) error { - _, err := v.client.Decode(v.coordinator.SetLINKAndLINKNativeFeed( - v.client.NewTXOpts(), - common.HexToAddress(linkAddress), - common.HexToAddress(linkNativeFeedAddress), - )) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) RegisterProvingKey( - publicProvingKey [2]*big.Int, - gasLaneMaxGas uint64, -) error { - _, err := v.client.Decode(v.coordinator.RegisterProvingKey(v.client.NewTXOpts(), publicProvingKey, gasLaneMaxGas)) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) CreateSubscription() (*types.Transaction, error) { - tx, err := v.client.Decode(v.coordinator.CreateSubscription(v.client.NewTXOpts())) - if err != nil { - return nil, err - } - return tx.Transaction, nil -} - -func (v *EthereumVRFCoordinatorV2_5) Migrate(subId *big.Int, coordinatorAddress string) (*seth.DecodedTransaction, *vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted, error) { - tx, err := v.client.Decode(v.coordinator.Migrate(v.client.NewTXOpts(), subId, common.HexToAddress(coordinatorAddress))) - if err != nil { - return nil, nil, err - } - var migrationCompletedEvent *vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted - for _, log := range tx.Receipt.Logs { - for _, topic := range log.Topics { - if topic.Cmp(vrf_coordinator_v2_5.VRFCoordinatorV25MigrationCompleted{}.Topic()) == 0 { - migrationCompletedEvent, err = v.coordinator.ParseMigrationCompleted(*log) - if err != nil { - return nil, nil, fmt.Errorf("parsing MigrationCompleted log failed, err: %w", err) - } - } - } - } - return tx, migrationCompletedEvent, err -} - -func (v *EthereumVRFCoordinatorV2_5) RegisterMigratableCoordinator(migratableCoordinatorAddress string) error { - _, err := v.client.Decode(v.coordinator.RegisterMigratableCoordinator(v.client.NewTXOpts(), common.HexToAddress(migratableCoordinatorAddress))) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) AddConsumer(subId *big.Int, consumerAddress string) error { - _, err := v.client.Decode(v.coordinator.AddConsumer( - v.client.NewTXOpts(), - subId, - common.HexToAddress(consumerAddress), - )) - return err -} - -func (v *EthereumVRFCoordinatorV2_5) FundSubscriptionWithNative(subId *big.Int, nativeTokenAmount *big.Int) error { - opts := v.client.NewTXOpts() - opts.Value = nativeTokenAmount - _, err := v.client.Decode(v.coordinator.FundSubscriptionWithNative( - opts, - subId, - )) - if err != nil { - return err - } - return nil -} - -func (v *EthereumVRFCoordinatorV2_5) FindSubscriptionID(subID *big.Int) (*big.Int, error) { - owner := v.client.MustGetRootKeyAddress() - subscriptionIterator, err := v.coordinator.FilterSubscriptionCreated( - nil, - []*big.Int{subID}, - ) - if err != nil { - return nil, err - } - - if !subscriptionIterator.Next() { - return nil, fmt.Errorf("expected at least 1 subID for the given owner %s", owner) - } - - return subscriptionIterator.Event.SubId, nil -} - -func (v *EthereumVRFCoordinatorV2_5) FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) { - iterator, err := v.coordinator.FilterRandomWordsFulfilled( - opts, - []*big.Int{requestId}, - nil, - ) - if err != nil { - return nil, err - } - if !iterator.Next() { - return nil, fmt.Errorf("expected at least 1 RandomWordsFulfilled event for request Id: %s", requestId.String()) - } - return &CoordinatorRandomWordsFulfilled{ - RequestId: iterator.Event.RequestId, - OutputSeed: iterator.Event.OutputSeed, - SubId: iterator.Event.SubId.String(), - Payment: iterator.Event.Payment, - NativePayment: iterator.Event.NativePayment, - Success: iterator.Event.Success, - OnlyPremium: iterator.Event.OnlyPremium, - Raw: iterator.Event.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2_5) WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) { - randomWordsFulfilledEventsChannel := make(chan *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsFulfilled) - subscription, err := v.coordinator.WatchRandomWordsFulfilled(nil, randomWordsFulfilledEventsChannel, filter.RequestIds, filter.SubIDs) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(filter.Timeout): - return nil, errors.New("timeout waiting for RandomWordsFulfilled event") - case randomWordsFulfilledEvent := <-randomWordsFulfilledEventsChannel: - return &CoordinatorRandomWordsFulfilled{ - RequestId: randomWordsFulfilledEvent.RequestId, - OutputSeed: randomWordsFulfilledEvent.OutputSeed, - SubId: randomWordsFulfilledEvent.SubId.String(), - Payment: randomWordsFulfilledEvent.Payment, - NativePayment: randomWordsFulfilledEvent.NativePayment, - Success: randomWordsFulfilledEvent.Success, - OnlyPremium: randomWordsFulfilledEvent.OnlyPremium, - Raw: randomWordsFulfilledEvent.Raw, - }, nil - } - } -} - -func (v *EthereumVRFCoordinatorV2_5) WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) { - eventsChannel := make(chan *vrf_coordinator_v2_5.VRFCoordinatorV25ConfigSet) - subscription, err := v.coordinator.WatchConfigSet(nil, eventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, errors.New("timeout waiting for ConfigSet event") - case event := <-eventsChannel: - return &CoordinatorConfigSet{ - MinimumRequestConfirmations: event.MinimumRequestConfirmations, - MaxGasLimit: event.MaxGasLimit, - StalenessSeconds: event.StalenessSeconds, - GasAfterPaymentCalculation: event.GasAfterPaymentCalculation, - FallbackWeiPerUnitLink: event.FallbackWeiPerUnitLink, - FulfillmentFlatFeeNativePPM: event.FulfillmentFlatFeeNativePPM, - FulfillmentFlatFeeLinkDiscountPPM: event.FulfillmentFlatFeeLinkDiscountPPM, - NativePremiumPercentage: event.NativePremiumPercentage, - LinkPremiumPercentage: event.LinkPremiumPercentage, - }, nil - } - } -} - -func (v *EthereumVRFCoordinatorV2_5_Optimism) SetL1FeeCalculation( - mode uint8, - coefficient uint8, -) error { - _, err := v.client.Decode(v.coordinator.SetL1FeeCalculation(v.client.NewTXOpts(), mode, coefficient)) - return err -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) RequestRandomness( - coordinator Coordinator, - keyHash [32]byte, subID *big.Int, - requestConfirmations uint16, - callbackGasLimit uint32, - nativePayment bool, - numWords uint32, - requestCount uint16, -) (*CoordinatorRandomWordsRequested, error) { - return v.RequestRandomnessFromKey(coordinator, keyHash, subID, requestConfirmations, callbackGasLimit, nativePayment, numWords, requestCount, 0) -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) RequestRandomnessFromKey( - coordinator Coordinator, - keyHash [32]byte, subID *big.Int, - requestConfirmations uint16, - callbackGasLimit uint32, - nativePayment bool, - numWords uint32, - requestCount uint16, - keyNum int, -) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.RequestRandomWords(v.client.NewTXKeyOpts(keyNum), subID, requestConfirmations, keyHash, callbackGasLimit, nativePayment, numWords, requestCount)) - if err != nil { - return nil, err - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) ResetMetrics() error { - _, err := v.client.Decode(v.consumer.Reset(v.client.NewTXOpts())) - return err -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) GetCoordinator(ctx context.Context) (common.Address, error) { - return v.consumer.SVrfCoordinator(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} -func (v *EthereumVRFv2PlusLoadTestConsumer) GetRequestStatus(ctx context.Context, requestID *big.Int) (vrf_v2plus_load_test_with_metrics.GetRequestStatus, error) { - return v.consumer.GetRequestStatus(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, requestID) -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) GetLastRequestId(ctx context.Context) (*big.Int, error) { - return v.consumer.SLastRequestId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFv2PlusLoadTestConsumer) GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) { - requestCount, err := v.consumer.SRequestCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - fulfilmentCount, err := v.consumer.SResponseCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - averageFulfillmentInMillions, err := v.consumer.SAverageResponseTimeInBlocksMillions(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - slowestFulfillment, err := v.consumer.SSlowestResponseTimeInBlocks(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - fastestFulfillment, err := v.consumer.SFastestResponseTimeInBlocks(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - averageResponseTimeInSeconds, err := v.consumer.SAverageResponseTimeInSecondsMillions(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - slowestResponseTimeInSeconds, err := v.consumer.SSlowestResponseTimeInSeconds(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - fastestResponseTimeInSeconds, err := v.consumer.SFastestResponseTimeInSeconds(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - var responseTimesInBlocks []uint32 - for { - currentResponseTimesInBlocks, err := v.consumer.GetRequestBlockTimes(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, big.NewInt(int64(len(responseTimesInBlocks))), big.NewInt(1000)) - if err != nil { - return nil, err - } - if len(currentResponseTimesInBlocks) == 0 { - break - } - responseTimesInBlocks = append(responseTimesInBlocks, currentResponseTimesInBlocks...) - } - var p90FulfillmentBlockTime, p95FulfillmentBlockTime float64 - if len(responseTimesInBlocks) == 0 { - p90FulfillmentBlockTime = 0 - p95FulfillmentBlockTime = 0 - } else { - responseTimesInBlocksFloat64 := make([]float64, len(responseTimesInBlocks)) - for i, value := range responseTimesInBlocks { - responseTimesInBlocksFloat64[i] = float64(value) - } - p90FulfillmentBlockTime, err = stats.Percentile(responseTimesInBlocksFloat64, 90) - if err != nil { - return nil, err - } - p95FulfillmentBlockTime, err = stats.Percentile(responseTimesInBlocksFloat64, 95) - if err != nil { - return nil, err - } - } - return &VRFLoadTestMetrics{ - RequestCount: requestCount, - FulfilmentCount: fulfilmentCount, - AverageFulfillmentInMillions: averageFulfillmentInMillions, - SlowestFulfillment: slowestFulfillment, - FastestFulfillment: fastestFulfillment, - P90FulfillmentBlockTime: p90FulfillmentBlockTime, - P95FulfillmentBlockTime: p95FulfillmentBlockTime, - AverageResponseTimeInSecondsMillions: averageResponseTimeInSeconds, - SlowestResponseTimeInSeconds: slowestResponseTimeInSeconds, - FastestResponseTimeInSeconds: fastestResponseTimeInSeconds, - }, nil -} - -// DeployBatchBlockhashStore deploys DeployBatchBlockhashStore contract -func DeployBatchBlockhashStore(seth *seth.Client, blockhashStoreAddr string) (BatchBlockhashStore, error) { - abi, err := batch_blockhash_store.BatchBlockhashStoreMetaData.GetAbi() - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to get BatchBlockhashStore ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "BatchBlockhashStore", - *abi, - common.FromHex(batch_blockhash_store.BatchBlockhashStoreMetaData.Bin), - common.HexToAddress(blockhashStoreAddr)) - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("BatchBlockhashStore instance deployment have failed: %w", err) - } - - contract, err := batch_blockhash_store.NewBatchBlockhashStore(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumBatchBlockhashStore{}, fmt.Errorf("failed to instantiate BatchBlockhashStore instance: %w", err) - } - - return &EthereumBatchBlockhashStore{ - client: seth, - batchBlockhashStore: contract, - address: data.Address, - }, err -} - -func DeployVRFCoordinatorV2PlusUpgradedVersion(client *seth.Client, bhsAddr string) (VRFCoordinatorV2PlusUpgradedVersion, error) { - abi, err := vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersionMetaData.GetAbi() - if err != nil { - return &EthereumVRFCoordinatorV2PlusUpgradedVersion{}, fmt.Errorf("failed to get VRFCoordinatorV2PlusUpgradedVersion ABI: %w", err) - } - - data, err := client.DeployContract( - client.NewTXOpts(), - "VRFCoordinatorV2PlusUpgradedVersion", - *abi, - common.FromHex(vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersionMetaData.Bin), - common.HexToAddress(bhsAddr)) - if err != nil { - return &EthereumVRFCoordinatorV2PlusUpgradedVersion{}, fmt.Errorf("VRFCoordinatorV2PlusUpgradedVersion instance deployment have failed: %w", err) - } - - contract, err := vrf_v2plus_upgraded_version.NewVRFCoordinatorV2PlusUpgradedVersion(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &EthereumVRFCoordinatorV2PlusUpgradedVersion{}, fmt.Errorf("failed to instantiate VRFCoordinatorV2PlusUpgradedVersion instance: %w", err) - } - - return &EthereumVRFCoordinatorV2PlusUpgradedVersion{ - client: client, - coordinator: contract, - address: data.Address, - }, err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) HashOfKey(ctx context.Context, pubKey [2]*big.Int) ([32]byte, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - hash, err := v.coordinator.HashOfKey(opts, pubKey) - if err != nil { - return [32]byte{}, err - } - return hash, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) GetActiveSubscriptionIds(ctx context.Context, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - activeSubscriptionIds, err := v.coordinator.GetActiveSubscriptionIds(opts, startIndex, maxCount) - if err != nil { - return nil, err - } - return activeSubscriptionIds, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) GetSubscription(ctx context.Context, subID *big.Int) (vrf_v2plus_upgraded_version.GetSubscription, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - subscription, err := v.coordinator.GetSubscription(opts, subID) - if err != nil { - return vrf_v2plus_upgraded_version.GetSubscription{}, err - } - return subscription, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) SetConfig( - minimumRequestConfirmations uint16, - maxGasLimit uint32, - stalenessSeconds uint32, - gasAfterPaymentCalculation uint32, - fallbackWeiPerUnitLink *big.Int, - fulfillmentFlatFeeNativePPM uint32, - fulfillmentFlatFeeLinkDiscountPPM uint32, - nativePremiumPercentage uint8, - linkPremiumPercentage uint8, -) error { - _, err := v.client.Decode(v.coordinator.SetConfig( - v.client.NewTXOpts(), - minimumRequestConfirmations, - maxGasLimit, - stalenessSeconds, - gasAfterPaymentCalculation, - fallbackWeiPerUnitLink, - fulfillmentFlatFeeNativePPM, - fulfillmentFlatFeeLinkDiscountPPM, - nativePremiumPercentage, - linkPremiumPercentage, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) SetLINKAndLINKNativeFeed(linkAddress string, linkNativeFeedAddress string) error { - _, err := v.client.Decode(v.coordinator.SetLINKAndLINKNativeFeed( - v.client.NewTXOpts(), - common.HexToAddress(linkAddress), - common.HexToAddress(linkNativeFeedAddress), - )) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) RegisterProvingKey( - publicProvingKey [2]*big.Int, - gasLaneMaxGas uint64, -) error { - _, err := v.client.Decode(v.coordinator.RegisterProvingKey(v.client.NewTXOpts(), publicProvingKey, gasLaneMaxGas)) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) CreateSubscription() error { - _, err := v.client.Decode(v.coordinator.CreateSubscription(v.client.NewTXOpts())) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) GetLinkTotalBalance(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - totalBalance, err := v.coordinator.STotalBalance(opts) - if err != nil { - return nil, err - } - return totalBalance, nil -} -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) GetNativeTokenTotalBalance(ctx context.Context) (*big.Int, error) { - opts := &bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - } - totalBalance, err := v.coordinator.STotalNativeBalance(opts) - if err != nil { - return nil, err - } - return totalBalance, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) Migrate(subId *big.Int, coordinatorAddress string) error { - _, err := v.client.Decode(v.coordinator.Migrate(v.client.NewTXOpts(), subId, common.HexToAddress(coordinatorAddress))) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) RegisterMigratableCoordinator(migratableCoordinatorAddress string) error { - _, err := v.client.Decode(v.coordinator.RegisterMigratableCoordinator(v.client.NewTXOpts(), common.HexToAddress(migratableCoordinatorAddress))) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) AddConsumer(subId *big.Int, consumerAddress string) error { - _, err := v.client.Decode(v.coordinator.AddConsumer( - v.client.NewTXOpts(), - subId, - common.HexToAddress(consumerAddress), - )) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) FundSubscriptionWithNative(subId *big.Int, nativeTokenAmount *big.Int) error { - opts := v.client.NewTXOpts() - opts.Value = nativeTokenAmount - _, err := v.client.Decode(v.coordinator.FundSubscriptionWithNative( - opts, - subId, - )) - return err -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) FindSubscriptionID() (*big.Int, error) { - owner := v.client.MustGetRootKeyAddress() - subscriptionIterator, err := v.coordinator.FilterSubscriptionCreated( - nil, - nil, - ) - if err != nil { - return nil, err - } - if !subscriptionIterator.Next() { - return nil, fmt.Errorf("expected at least 1 subID for the given owner %s", owner) - } - return subscriptionIterator.Event.SubId, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) FilterRandomWordsFulfilledEvent(opts *bind.FilterOpts, requestId *big.Int) (*CoordinatorRandomWordsFulfilled, error) { - iterator, err := v.coordinator.FilterRandomWordsFulfilled( - opts, - []*big.Int{requestId}, - nil, - ) - if err != nil { - return nil, err - } - if !iterator.Next() { - return nil, fmt.Errorf("expected at least 1 RandomWordsFulfilled event for request Id: %s", requestId.String()) - } - return &CoordinatorRandomWordsFulfilled{ - RequestId: iterator.Event.RequestId, - OutputSeed: iterator.Event.OutputSeed, - SubId: iterator.Event.SubId.String(), - Payment: iterator.Event.Payment, - NativePayment: iterator.Event.NativePayment, - Success: iterator.Event.Success, - OnlyPremium: iterator.Event.OnlyPremium, - Raw: iterator.Event.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) WaitForRandomWordsFulfilledEvent(filter RandomWordsFulfilledEventFilter) (*CoordinatorRandomWordsFulfilled, error) { - randomWordsFulfilledEventsChannel := make(chan *vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersionRandomWordsFulfilled) - subscription, err := v.coordinator.WatchRandomWordsFulfilled(nil, randomWordsFulfilledEventsChannel, filter.RequestIds, filter.SubIDs) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(filter.Timeout): - return nil, errors.New("timeout waiting for RandomWordsFulfilled event") - case randomWordsFulfilledEvent := <-randomWordsFulfilledEventsChannel: - return &CoordinatorRandomWordsFulfilled{ - RequestId: randomWordsFulfilledEvent.RequestId, - OutputSeed: randomWordsFulfilledEvent.OutputSeed, - SubId: randomWordsFulfilledEvent.SubId.String(), - Payment: randomWordsFulfilledEvent.Payment, - NativePayment: randomWordsFulfilledEvent.NativePayment, - Success: randomWordsFulfilledEvent.Success, - OnlyPremium: randomWordsFulfilledEvent.OnlyPremium, - Raw: randomWordsFulfilledEvent.Raw, - }, nil - } - } -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) ParseRandomWordsRequested(log types.Log) (*CoordinatorRandomWordsRequested, error) { - randomWordsRequested, err := v.coordinator.ParseRandomWordsRequested(log) - if err != nil { - return nil, err - } - coordinatorRandomWordsRequested := &CoordinatorRandomWordsRequested{ - KeyHash: randomWordsRequested.KeyHash, - RequestId: randomWordsRequested.RequestId, - PreSeed: randomWordsRequested.PreSeed, - SubId: randomWordsRequested.SubId.String(), - MinimumRequestConfirmations: randomWordsRequested.MinimumRequestConfirmations, - CallbackGasLimit: randomWordsRequested.CallbackGasLimit, - NumWords: randomWordsRequested.NumWords, - ExtraArgs: randomWordsRequested.ExtraArgs, - Sender: randomWordsRequested.Sender, - Raw: randomWordsRequested.Raw, - } - return coordinatorRandomWordsRequested, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) ParseRandomWordsFulfilled(log types.Log) (*CoordinatorRandomWordsFulfilled, error) { - fulfilled, err := v.coordinator.ParseRandomWordsFulfilled(log) - if err != nil { - return nil, fmt.Errorf("failed to parse RandomWordsFulfilled event: %w", err) - } - return &CoordinatorRandomWordsFulfilled{ - RequestId: fulfilled.RequestId, - OutputSeed: fulfilled.OutputSeed, - Payment: fulfilled.Payment, - SubId: fulfilled.SubId.String(), - NativePayment: fulfilled.NativePayment, - OnlyPremium: fulfilled.OnlyPremium, - Success: fulfilled.Success, - Raw: fulfilled.Raw, - }, nil -} - -func (v *EthereumVRFCoordinatorV2PlusUpgradedVersion) WaitForConfigSetEvent(timeout time.Duration) (*CoordinatorConfigSet, error) { - eventsChannel := make(chan *vrf_v2plus_upgraded_version.VRFCoordinatorV2PlusUpgradedVersionConfigSet) - subscription, err := v.coordinator.WatchConfigSet(nil, eventsChannel) - if err != nil { - return nil, err - } - defer subscription.Unsubscribe() - for { - select { - case err := <-subscription.Err(): - return nil, err - case <-time.After(timeout): - return nil, errors.New("timeout waiting for ConfigSet event") - case event := <-eventsChannel: - return &CoordinatorConfigSet{ - MinimumRequestConfirmations: event.MinimumRequestConfirmations, - MaxGasLimit: event.MaxGasLimit, - StalenessSeconds: event.StalenessSeconds, - GasAfterPaymentCalculation: event.GasAfterPaymentCalculation, - FallbackWeiPerUnitLink: event.FallbackWeiPerUnitLink, - FulfillmentFlatFeeNativePPM: event.FulfillmentFlatFeeNativePPM, - FulfillmentFlatFeeLinkDiscountPPM: event.FulfillmentFlatFeeLinkDiscountPPM, - NativePremiumPercentage: event.NativePremiumPercentage, - LinkPremiumPercentage: event.LinkPremiumPercentage, - }, nil - } - } -} - -func DeployVRFv2PlusLoadTestConsumer(seth *seth.Client, coordinatorAddr string) (VRFv2PlusLoadTestConsumer, error) { - abi, err := vrf_v2plus_load_test_with_metrics.VRFV2PlusLoadTestWithMetricsMetaData.GetAbi() - if err != nil { - return &EthereumVRFv2PlusLoadTestConsumer{}, fmt.Errorf("failed to get VRFV2PlusLoadTestWithMetrics ABI: %w", err) - } - - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFV2PlusLoadTestWithMetrics", - *abi, - common.FromHex(vrf_v2plus_load_test_with_metrics.VRFV2PlusLoadTestWithMetricsMetaData.Bin), - common.HexToAddress(coordinatorAddr)) - if err != nil { - return &EthereumVRFv2PlusLoadTestConsumer{}, fmt.Errorf("VRFV2PlusLoadTestWithMetrics instance deployment have failed: %w", err) - } - - contract, err := vrf_v2plus_load_test_with_metrics.NewVRFV2PlusLoadTestWithMetrics(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFv2PlusLoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2PlusLoadTestWithMetrics instance: %w", err) - } - - return &EthereumVRFv2PlusLoadTestConsumer{ - client: seth, - consumer: contract, - address: data.Address, - }, err -} - -func DeployVRFV2PlusWrapper(seth *seth.Client, linkAddr string, linkEthFeedAddr string, coordinatorAddr string, subId *big.Int) (VRFV2PlusWrapper, error) { - abi, err := vrfv2plus_wrapper.VRFV2PlusWrapperMetaData.GetAbi() - if err != nil { - return &EthereumVRFV2PlusWrapper{}, fmt.Errorf("failed to get VRFV2PlusWrapper ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFV2PlusWrapper", - *abi, - common.FromHex(vrfv2plus_wrapper.VRFV2PlusWrapperMetaData.Bin), - common.HexToAddress(linkAddr), common.HexToAddress(linkEthFeedAddr), - common.HexToAddress(coordinatorAddr), subId) - if err != nil { - return &EthereumVRFV2PlusWrapper{}, fmt.Errorf("VRFV2PlusWrapper instance deployment have failed: %w", err) - } - contract, err := vrfv2plus_wrapper.NewVRFV2PlusWrapper(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFV2PlusWrapper{}, fmt.Errorf("failed to instantiate VRFV2PlusWrapper instance: %w", err) - } - return &EthereumVRFV2PlusWrapper{ - client: seth, - wrapper: contract, - address: data.Address, - }, err -} - -func DeployVRFV2PlusWrapperArbitrum(seth *seth.Client, linkAddr string, linkEthFeedAddr string, coordinatorAddr string, subId *big.Int) (*EthereumVRFV2PlusWrapperArbitrum, error) { - abi, err := vrfv2plus_wrapper_arbitrum.VRFV2PlusWrapperArbitrumMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFV2PlusWrapper_Arbitrum ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFV2PlusWrapper_Arbitrum", - *abi, - common.FromHex(vrfv2plus_wrapper_arbitrum.VRFV2PlusWrapperArbitrumMetaData.Bin), - common.HexToAddress(linkAddr), common.HexToAddress(linkEthFeedAddr), - common.HexToAddress(coordinatorAddr), subId) - if err != nil { - return nil, fmt.Errorf("VRFV2PlusWrapper_Arbitrum instance deployment have failed: %w", err) - } - contract, err := vrfv2plus_wrapper_arbitrum.NewVRFV2PlusWrapperArbitrum(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFV2PlusWrapper_Arbitrum instance: %w", err) - } - return &EthereumVRFV2PlusWrapperArbitrum{ - client: seth, - wrapper: contract, - Address: data.Address, - }, err -} - -func DeployVRFV2PlusWrapperOptimism(seth *seth.Client, linkAddr string, linkEthFeedAddr string, coordinatorAddr string, subId *big.Int) (*EthereumVRFV2PlusWrapperOptimism, error) { - abi, err := vrfv2plus_wrapper_optimism.VRFV2PlusWrapperOptimismMetaData.GetAbi() - if err != nil { - return nil, fmt.Errorf("failed to get VRFV2PlusWrapper_Optimism ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFV2PlusWrapper_Optimism", - *abi, - common.FromHex(vrfv2plus_wrapper_optimism.VRFV2PlusWrapperOptimismMetaData.Bin), - common.HexToAddress(linkAddr), common.HexToAddress(linkEthFeedAddr), - common.HexToAddress(coordinatorAddr), subId) - if err != nil { - return nil, fmt.Errorf("VRFV2PlusWrapper_Optimism instance deployment have failed: %w", err) - } - contract, err := vrfv2plus_wrapper_optimism.NewVRFV2PlusWrapperOptimism(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return nil, fmt.Errorf("failed to instantiate VRFV2PlusWrapper_Optimism instance: %w", err) - } - return &EthereumVRFV2PlusWrapperOptimism{ - client: seth, - wrapper: contract, - Address: data.Address, - }, err -} - -func DeployVRFV2PlusWrapperLoadTestConsumer(seth *seth.Client, vrfV2PlusWrapperAddr string) (VRFv2PlusWrapperLoadTestConsumer, error) { - abi, err := vrfv2plus_wrapper_load_test_consumer.VRFV2PlusWrapperLoadTestConsumerMetaData.GetAbi() - if err != nil { - return &EthereumVRFV2PlusWrapperLoadTestConsumer{}, fmt.Errorf("failed to get VRFV2PlusWrapperLoadTestConsumer ABI: %w", err) - } - data, err := seth.DeployContract( - seth.NewTXOpts(), - "VRFV2PlusWrapperLoadTestConsumer", - *abi, - common.FromHex(vrfv2plus_wrapper_load_test_consumer.VRFV2PlusWrapperLoadTestConsumerMetaData.Bin), - common.HexToAddress(vrfV2PlusWrapperAddr)) - if err != nil { - return &EthereumVRFV2PlusWrapperLoadTestConsumer{}, fmt.Errorf("VRFV2PlusWrapperLoadTestConsumer instance deployment have failed: %w", err) - } - - contract, err := vrfv2plus_wrapper_load_test_consumer.NewVRFV2PlusWrapperLoadTestConsumer(data.Address, wrappers.MustNewWrappedContractBackend(nil, seth)) - if err != nil { - return &EthereumVRFV2PlusWrapperLoadTestConsumer{}, fmt.Errorf("failed to instantiate VRFV2PlusWrapperLoadTestConsumer instance: %w", err) - } - return &EthereumVRFV2PlusWrapperLoadTestConsumer{ - client: seth, - consumer: contract, - address: data.Address, - }, err -} - -func (v *EthereumVRFV2PlusWrapperOptimism) SetL1FeeCalculation(mode uint8, coefficient uint8) error { - _, err := v.client.Decode(v.wrapper.SetL1FeeCalculation(v.client.NewTXOpts(), mode, coefficient)) - return err -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) Address() string { - return v.address.Hex() -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) Fund(_ *big.Float) error { - panic("do not use this function, use actions.SendFunds() instead, otherwise we will have to deal with circular dependencies") -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) RequestRandomness( - coordinator Coordinator, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, -) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.MakeRequests(v.client.NewTXOpts(), callbackGasLimit, requestConfirmations, numWords, requestCount)) - if err != nil { - return nil, err - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) RequestRandomnessNative( - coordinator Coordinator, - requestConfirmations uint16, - callbackGasLimit uint32, - numWords uint32, - requestCount uint16, -) (*CoordinatorRandomWordsRequested, error) { - tx, err := v.client.Decode(v.consumer.MakeRequestsNative(v.client.NewTXOpts(), callbackGasLimit, requestConfirmations, numWords, requestCount)) - if err != nil { - return nil, err - } - randomWordsRequestedEvent, err := parseRequestRandomnessLogs(coordinator, tx.Receipt.Logs) - if err != nil { - return nil, err - } - return randomWordsRequestedEvent, nil -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) GetRequestStatus(ctx context.Context, requestID *big.Int) (vrfv2plus_wrapper_load_test_consumer.GetRequestStatus, error) { - return v.consumer.GetRequestStatus(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }, requestID) -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) GetLastRequestId(ctx context.Context) (*big.Int, error) { - return v.consumer.SLastRequestId(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) GetWrapper(ctx context.Context) (common.Address, error) { - return v.consumer.IVrfV2PlusWrapper(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) -} - -func (v *EthereumVRFV2PlusWrapperLoadTestConsumer) GetLoadTestMetrics(ctx context.Context) (*VRFLoadTestMetrics, error) { - requestCount, err := v.consumer.SRequestCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - fulfilmentCount, err := v.consumer.SResponseCount(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - averageFulfillmentInMillions, err := v.consumer.SAverageFulfillmentInMillions(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - slowestFulfillment, err := v.consumer.SSlowestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - - if err != nil { - return nil, err - } - fastestFulfillment, err := v.consumer.SFastestFulfillment(&bind.CallOpts{ - From: v.client.MustGetRootKeyAddress(), - Context: ctx, - }) - if err != nil { - return nil, err - } - - return &VRFLoadTestMetrics{ - RequestCount: requestCount, - FulfilmentCount: fulfilmentCount, - AverageFulfillmentInMillions: averageFulfillmentInMillions, - SlowestFulfillment: slowestFulfillment, - FastestFulfillment: fastestFulfillment, - AverageResponseTimeInSecondsMillions: nil, - SlowestResponseTimeInSeconds: nil, - FastestResponseTimeInSeconds: nil, - }, nil -} diff --git a/integration-tests/contracts/multicall.go b/integration-tests/contracts/multicall.go index cd7134a8d85..ecc4afe8b6d 100644 --- a/integration-tests/contracts/multicall.go +++ b/integration-tests/contracts/multicall.go @@ -56,6 +56,5 @@ func MultiCallLogTriggerLoadGen( data := Call{Target: common.HexToAddress(logTriggerAddress[i]), AllowFailure: false, CallData: d} call = append(call, data) } - // call aggregate3 to group all msg call data and send them in a single transaction return boundContract.Transact(client.NewTXKeyOpts(client.AnySyncedKey()), "aggregate3", call) } diff --git a/integration-tests/contracts/test_contracts.go b/integration-tests/contracts/test_contracts.go deleted file mode 100644 index ad00b19a674..00000000000 --- a/integration-tests/contracts/test_contracts.go +++ /dev/null @@ -1,124 +0,0 @@ -package contracts - -import ( - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - le "github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/log_emitter" - "github.com/smartcontractkit/chainlink/integration-tests/wrappers" -) - -type LogEmitterContract struct { - address common.Address - client *seth.Client - instance *le.LogEmitter - l zerolog.Logger -} - -func (e *LogEmitterContract) Address() common.Address { - return e.address -} - -func (e *LogEmitterContract) EmitLogIntsFromKey(ints []int, keyNum int) (*types.Transaction, error) { - bigInts := make([]*big.Int, len(ints)) - for i, v := range ints { - bigInts[i] = big.NewInt(int64(v)) - } - tx, err := e.client.Decode(e.instance.EmitLog1(e.client.NewTXKeyOpts(keyNum), bigInts)) - if err != nil { - return nil, err - } - - return tx.Transaction, nil -} - -func (e *LogEmitterContract) EmitLogInts(ints []int) (*types.Transaction, error) { - return e.EmitLogIntsFromKey(ints, 0) -} - -func (e *LogEmitterContract) EmitLogIntsIndexedFromKey(ints []int, keyNum int) (*types.Transaction, error) { - bigInts := make([]*big.Int, len(ints)) - for i, v := range ints { - bigInts[i] = big.NewInt(int64(v)) - } - tx, err := e.client.Decode(e.instance.EmitLog2(e.client.NewTXKeyOpts(keyNum), bigInts)) - if err != nil { - return nil, err - } - - return tx.Transaction, nil -} - -func (e *LogEmitterContract) EmitLogIntsIndexed(ints []int) (*types.Transaction, error) { - return e.EmitLogIntsIndexedFromKey(ints, 0) -} - -func (e *LogEmitterContract) EmitLogIntMultiIndexedFromKey(ints int, ints2 int, count int, keyNum int) (*types.Transaction, error) { - tx, err := e.client.Decode(e.instance.EmitLog4(e.client.NewTXKeyOpts(keyNum), big.NewInt(int64(ints)), big.NewInt(int64(ints2)), big.NewInt(int64(count)))) - if err != nil { - return nil, err - } - - return tx.Transaction, nil -} - -func (e *LogEmitterContract) EmitLogIntMultiIndexed(ints int, ints2 int, count int) (*types.Transaction, error) { - return e.EmitLogIntMultiIndexedFromKey(ints, ints2, count, 0) -} - -func (e *LogEmitterContract) EmitLogStringsFromKey(strings []string, keyNum int) (*types.Transaction, error) { - tx, err := e.client.Decode(e.instance.EmitLog3(e.client.NewTXKeyOpts(keyNum), strings)) - if err != nil { - return nil, err - } - return tx.Transaction, nil -} - -func (e *LogEmitterContract) EmitLogStrings(strings []string) (*types.Transaction, error) { - return e.EmitLogStringsFromKey(strings, 0) -} - -func (e *LogEmitterContract) EmitLogInt(payload int) (*types.Transaction, error) { - return e.EmitLogInts([]int{payload}) -} - -func (e *LogEmitterContract) EmitLogIntIndexed(payload int) (*types.Transaction, error) { - return e.EmitLogIntsIndexed([]int{payload}) -} - -func (e *LogEmitterContract) EmitLogString(strings string) (*types.Transaction, error) { - return e.EmitLogStrings([]string{strings}) -} - -func DeployLogEmitterContract(l zerolog.Logger, client *seth.Client) (LogEmitter, error) { - return DeployLogEmitterContractFromKey(l, client, 0) -} - -func DeployLogEmitterContractFromKey(l zerolog.Logger, client *seth.Client, keyNum int) (LogEmitter, error) { - abi, err := le.LogEmitterMetaData.GetAbi() - if err != nil { - return &LogEmitterContract{}, fmt.Errorf("failed to get LogEmitter ABI: %w", err) - } - data, err := client.DeployContract(client.NewTXKeyOpts(keyNum), "LogEmitter", *abi, common.FromHex(le.LogEmitterMetaData.Bin)) - if err != nil { - return &LogEmitterContract{}, fmt.Errorf("LogEmitter instance deployment have failed: %w", err) - } - - instance, err := le.NewLogEmitter(data.Address, wrappers.MustNewWrappedContractBackend(nil, client)) - if err != nil { - return &LogEmitterContract{}, fmt.Errorf("failed to instantiate LogEmitter instance: %w", err) - } - - return &LogEmitterContract{ - client: client, - instance: instance, - address: data.Address, - l: l, - }, err -} diff --git a/integration-tests/docker/cmd/internal/commands.go b/integration-tests/docker/cmd/internal/commands.go deleted file mode 100644 index bd9d505a7e3..00000000000 --- a/integration-tests/docker/cmd/internal/commands.go +++ /dev/null @@ -1,80 +0,0 @@ -package internal - -import ( - "os" - "os/signal" - "syscall" - - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" - - ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -var NodeCountFlag = "node-count" - -var StartNodesCmd = &cobra.Command{ - Use: "start-nodes", - Short: "Start Chainlink nodes", - RunE: func(cmd *cobra.Command, _ []string) error { - nodeCount, err := cmd.Flags().GetInt(NodeCountFlag) - if err != nil { - return err - } - - log.Logger = logging.GetLogger(nil, "CORE_DOCKER_ENV_LOG_LEVEL") - log.Info().Msg("Starting docker test env with Chainlink nodes..") - - config, err := testconfig.GetConfig([]string{"Smoke"}, testconfig.OCR2) - if err != nil { - return err - } - - ethBuilder := ctf_test_env.NewEthereumNetworkBuilder() - network, err := ethBuilder. - WithExistingConfig(*config.GetPrivateEthereumNetworkConfig()). - Build() - if err != nil { - return err - } - - _, err = test_env.NewCLTestEnvBuilder(). - WithTestConfig(&config). - WithPrivateEthereumNetwork(network.EthereumNetworkConfig). - WithMockAdapter(). - WithCLNodes(nodeCount). - WithoutCleanup(). - Build() - if err != nil { - return err - } - - log.Info().Msg("Test env is ready") - - handleExitSignal() - - return nil - }, -} - -func init() { - StartNodesCmd.PersistentFlags().Int( - NodeCountFlag, - 6, - "Number of Chainlink nodes", - ) -} - -func handleExitSignal() { - // Create a channel to receive exit signals - exitChan := make(chan os.Signal, 1) - signal.Notify(exitChan, os.Interrupt, syscall.SIGTERM) - - log.Info().Msg("Press Ctrl+C to destroy the test environment") - - // Block until an exit signal is received - <-exitChan -} diff --git a/integration-tests/docker/cmd/main.go b/integration-tests/docker/cmd/main.go deleted file mode 100644 index 16778adb062..00000000000 --- a/integration-tests/docker/cmd/main.go +++ /dev/null @@ -1,36 +0,0 @@ -package main - -import ( - "io" - defaultLog "log" - "os" - - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" - tcLog "github.com/testcontainers/testcontainers-go/log" - - "github.com/smartcontractkit/chainlink/integration-tests/docker/cmd/internal" -) - -var rootCmd = &cobra.Command{ - Use: "coreqa", - Short: "Core QA test tool", -} - -func init() { - rootCmd.AddCommand(internal.StartNodesCmd) - - // Set default log level for non-testcontainer code - zerolog.SetGlobalLevel(zerolog.InfoLevel) - - // Discard testcontainers logs - tcLog.SetDefault(defaultLog.New(io.Discard, "", defaultLog.LstdFlags)) -} - -func main() { - if err := rootCmd.Execute(); err != nil { - log.Error().Err(err).Msg("Error") - os.Exit(1) - } -} diff --git a/integration-tests/docker/node_coverage_helper.go b/integration-tests/docker/node_coverage_helper.go deleted file mode 100644 index a2efb21b702..00000000000 --- a/integration-tests/docker/node_coverage_helper.go +++ /dev/null @@ -1,166 +0,0 @@ -package docker - -import ( - "context" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - "sync" - - "github.com/pkg/errors" - tc "github.com/testcontainers/testcontainers-go" -) - -type NodeCoverageHelper struct { - Nodes []tc.Container - GoCoverSrcDir string // Path to the source directory on the chainlink image with go coverage data - NodeCoverageDirs []string // Paths to individual node coverage directories - CoverageDir string // Path to the base directory with all coverage - MergedDir string // Path to the directory where all coverage will be merged - ChainlinkDir string // Path to the root chainlink directory -} - -func NewNodeCoverageHelper(ctx context.Context, nodes []tc.Container, chainlinkDir, coverageDir string) (*NodeCoverageHelper, error) { - coverSrcDir := os.Getenv("GO_COVERAGE_SRC_DIR") - if coverSrcDir == "" { - coverSrcDir = "/var/tmp/go-coverage" // Default path - } - - helper := &NodeCoverageHelper{ - Nodes: nodes, - GoCoverSrcDir: coverSrcDir, - CoverageDir: coverageDir, - MergedDir: filepath.Join(coverageDir, "merged"), - ChainlinkDir: chainlinkDir, - } - - if err := os.MkdirAll(coverageDir, 0755); err != nil { - return nil, errors.Wrap(err, "failed to create base directory for node coverage") - } - - // Copy coverage data from nodes - if err := helper.copyCoverageFromNodes(ctx); err != nil { - return nil, errors.Wrap(err, "failed to copy coverage from nodes during initialization") - } - - // Merge the coverage data - if err := helper.mergeCoverage(); err != nil { - return nil, errors.Wrap(err, "failed to merge coverage data") - } - - return helper, nil -} - -func (c *NodeCoverageHelper) SaveMergedHTMLReport() (string, error) { - // Generate the textual coverage report - txtCommand := exec.Command("go", "tool", "covdata", "textfmt", "-i=.", "-o=cov.txt") - txtCommand.Dir = c.MergedDir - if txtOutput, err := txtCommand.CombinedOutput(); err != nil { - return "", errors.Wrapf(err, "failed to generate textual coverage report: %s", string(txtOutput)) - } - - // Generate the HTML coverage report - htmlFilePath := filepath.Join(c.CoverageDir, "coverage.html") - // #nosec G204 - htmlCommand := exec.Command("go", "tool", "cover", "-html="+filepath.Join(c.MergedDir, "cov.txt"), "-o="+htmlFilePath) - htmlCommand.Dir = c.ChainlinkDir - if htmlOutput, err := htmlCommand.CombinedOutput(); err != nil { - return "", errors.Wrapf(err, "failed to generate HTML coverage report: %s", string(htmlOutput)) - } - - return htmlFilePath, nil -} - -func (c *NodeCoverageHelper) SaveMergedCoveragePercentage() (string, error) { - filePath := filepath.Join(c.CoverageDir, "percentage.txt") - - // Calculate coverage percentage from the merged data - percentCmd := exec.Command("go", "tool", "covdata", "percent", "-i=.") - percentCmd.Dir = c.MergedDir // Ensure the command runs in the directory with the merged data - output, err := percentCmd.CombinedOutput() - if err != nil { - return "", fmt.Errorf("failed to get merged coverage percentage report: %w, output: %s", err, string(output)) - } - - // Save the cmd output to a file - if err := os.WriteFile(filePath, output, 0600); err != nil { - return "", errors.Wrap(err, "failed to write coverage percentage to file") - } - - return filePath, nil -} - -func (c *NodeCoverageHelper) mergeCoverage() error { - if err := os.MkdirAll(c.MergedDir, 0755); err != nil { - return fmt.Errorf("failed to create merged directory: %w", err) - } - - // Merge the coverage data from all chainlink nodes - dirInput := strings.Join(c.NodeCoverageDirs, ",") - // #nosec G204 - mergeCmd := exec.Command("go", "tool", "covdata", "merge", "-o", c.MergedDir, "-i="+dirInput) - mergeCmd.Dir = filepath.Dir(c.MergedDir) - output, err := mergeCmd.CombinedOutput() - if err != nil { - return fmt.Errorf("error executing merge command: %w, output: %s", err, string(output)) - } - - // Remove the coverage dirs after merging - for _, dir := range c.NodeCoverageDirs { - if err := os.RemoveAll(dir); err != nil { - return fmt.Errorf("failed to remove directory %s: %w", dir, err) - } - } - c.NodeCoverageDirs = []string{} // Reset the coverage paths after merging - - return nil -} - -func (c *NodeCoverageHelper) copyCoverageFromNodes(ctx context.Context) error { - var wg sync.WaitGroup - errorsChan := make(chan error, len(c.Nodes)) - - for i, node := range c.Nodes { - wg.Add(1) - go func(n tc.Container, id int) { - if n == nil { - errorsChan <- fmt.Errorf("node %d is nil", id) - return - } - defer wg.Done() - finalDestPath := filepath.Join(c.CoverageDir, fmt.Sprintf("node_%d", id)) - if err := os.MkdirAll(finalDestPath, 0755); err != nil { - errorsChan <- fmt.Errorf("failed to create directory for node %d: %w", id, err) - return - } - err := copyFolderFromContainerUsingDockerCP(ctx, n.GetContainerID(), c.GoCoverSrcDir, finalDestPath) - if err != nil { - errorsChan <- fmt.Errorf("failed to copy folder from container for node %d: %w", id, err) - return - } - finalDestPath = filepath.Join(finalDestPath, "go-coverage") // Assuming path structure /var/tmp/go-coverage/TestRegex/node_X/go-coverage - c.NodeCoverageDirs = append(c.NodeCoverageDirs, finalDestPath) - }(node, i) - } - - wg.Wait() - close(errorsChan) - - for err := range errorsChan { - if err != nil { - return err - } - } - - return nil -} -func copyFolderFromContainerUsingDockerCP(ctx context.Context, containerID, srcPath, destPath string) error { - source := fmt.Sprintf("%s:%s", containerID, srcPath) - cmd := exec.CommandContext(ctx, "docker", "cp", source, destPath) - if output, err := cmd.CombinedOutput(); err != nil { - return errors.Wrapf(err, "docker cp command failed: %s, output: %s", cmd, string(output)) - } - return nil -} diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 9a7366ce879..d297b0b88e9 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -1,15 +1,11 @@ package test_env import ( - "context" "errors" "fmt" - "os" "path/filepath" "runtime" - "strings" "testing" - "time" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -25,8 +21,6 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ccip" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - - d "github.com/smartcontractkit/chainlink/integration-tests/docker" ) var ErrFundCLNode = "failed to fund CL node" @@ -211,85 +205,6 @@ func (te *CLClusterTestEnv) Cleanup(opts CleanupOpts) error { te.logWhetherAllContainersAreRunning() - err := te.handleNodeCoverageReports(opts.TestName) - if err != nil { - te.l.Error().Err(err).Msg("Error handling node coverage reports") - } - - return nil -} - -// handleNodeCoverageReports handles the coverage reports for the chainlink nodes -func (te *CLClusterTestEnv) handleNodeCoverageReports(testName string) error { - testName = strings.ReplaceAll(testName, "/", "_") - showHTMLCoverageReport := te.TestConfig.GetLoggingConfig().ShowHTMLCoverageReport != nil && *te.TestConfig.GetLoggingConfig().ShowHTMLCoverageReport - isCI := os.Getenv("CI") != "" - - te.l.Info(). - Bool("showCoverageReportFlag", showHTMLCoverageReport). - Bool("isCI", isCI). - Bool("show", showHTMLCoverageReport || isCI). - Msg("Checking if coverage report should be shown") - - var covHelper *d.NodeCoverageHelper - - if showHTMLCoverageReport || isCI { - // Stop all nodes in the chainlink cluster. - // This is needed to get go coverage profile from the node containers https://go.dev/doc/build-cover#FAQ - // TODO: fix this as it results in: ERR LOG AFTER TEST ENDED ... INF 🐳 Stopping container - err := te.ClCluster.Stop() - if err != nil { - return err - } - - clDir, err := getChainlinkDir() - if err != nil { - return err - } - - var coverageRootDir string - if os.Getenv("GO_COVERAGE_DEST_DIR") != "" { - coverageRootDir = filepath.Join(os.Getenv("GO_COVERAGE_DEST_DIR"), testName) - } else { - coverageRootDir = filepath.Join(clDir, ".covdata", testName) - } - - var containers []tc.Container - for _, node := range te.ClCluster.Nodes { - containers = append(containers, node.Container) - } - - // there might be some corner cases where Docker daemon is not responding - // exit the test early if we can't connect to the container in under 1 minute - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - covHelper, err = d.NewNodeCoverageHelper(ctx, containers, clDir, coverageRootDir) - if err != nil { - return err - } - } - - // Show html coverage report when flag is set (local runs) - if showHTMLCoverageReport { - path, err := covHelper.SaveMergedHTMLReport() - if err != nil { - return err - } - te.l.Info().Str("testName", testName).Str("filePath", path).Msg("Chainlink node coverage html report saved") - } - - // Save percentage coverage report when running in CI - if isCI { - // Save coverage percentage to a file to show in the CI - path, err := covHelper.SaveMergedCoveragePercentage() - if err != nil { - te.l.Error().Err(err).Str("testName", testName).Msg("Failed to save coverage percentage for test") - } else { - te.l.Info().Str("testName", testName).Str("filePath", path).Msg("Chainlink node coverage percentage report saved") - } - } - return nil } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index b06923d0586..bb95072a270 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -19,31 +19,22 @@ require ( github.com/AlekSi/pointer v1.1.0 github.com/Masterminds/semver/v3 v3.4.0 github.com/aptos-labs/aptos-go-sdk v1.12.1-0.20260318141106-21b6ef4ed363 - github.com/avast/retry-go v3.0.0+incompatible github.com/avast/retry-go/v4 v4.7.0 - github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df github.com/block-vision/sui-go-sdk v1.1.4 - github.com/cli/go-gh/v2 v2.13.0 github.com/deckarep/golang-set/v2 v2.8.0 github.com/ethereum/go-ethereum v1.17.1 github.com/gagliardetto/solana-go v1.13.0 - github.com/go-resty/resty/v2 v2.17.2 github.com/google/uuid v1.6.0 github.com/jmoiron/sqlx v1.4.0 github.com/lib/pq v1.11.1 - github.com/manifoldco/promptui v0.9.0 - github.com/montanaflynn/stats v0.7.1 github.com/onsi/gomega v1.36.2 github.com/pelletier/go-toml/v2 v2.2.4 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.34.0 - github.com/scylladb/go-reflectx v1.0.1 github.com/segmentio/ksuid v1.0.4 - github.com/shopspring/decimal v1.4.0 github.com/slack-go/slack v0.15.0 github.com/smartcontractkit/chain-selectors v1.0.97 github.com/smartcontractkit/chainlink-aptos v0.0.0-20260318173523-755cafb24200 - github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260317185256-d5f7db87ae70 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288 github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 @@ -55,23 +46,18 @@ require ( github.com/smartcontractkit/chainlink-protos/job-distributor v0.18.0 github.com/smartcontractkit/chainlink-sui v0.0.0-20260304150206-c64e48eb0cb0 github.com/smartcontractkit/chainlink-sui/deployment v0.0.0-20260304150206-c64e48eb0cb0 - github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.5 github.com/smartcontractkit/chainlink-testing-framework/lib v1.54.7 - github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.51.0 github.com/smartcontractkit/chainlink-testing-framework/parrot v0.6.2 github.com/smartcontractkit/chainlink-testing-framework/sentinel v0.1.2 github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5 - github.com/smartcontractkit/chainlink-testing-framework/wasp v1.51.2 github.com/smartcontractkit/chainlink-ton v0.0.0-20260318210736-c3f360fd19a8 github.com/smartcontractkit/chainlink-ton/deployment v0.0.0-20260318210736-c3f360fd19a8 github.com/smartcontractkit/libocr v0.0.0-20260304194147-a03701e2c02e github.com/smartcontractkit/mcms v0.38.2 github.com/smartcontractkit/quarantine v0.0.0-20250909213106-ece491bef618 - github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 github.com/subosito/gotenv v1.6.0 github.com/testcontainers/testcontainers-go v0.41.0 - github.com/umbracle/ethgo v0.1.3 github.com/xssnick/tonutils-go v1.14.1 go.uber.org/atomic v1.11.0 go.uber.org/zap v1.27.1 @@ -84,9 +70,6 @@ require ( ) require ( - cloud.google.com/go/auth v0.16.2 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.9.0 // indirect cosmossdk.io/api v0.7.6 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.0 // indirect @@ -101,18 +84,12 @@ require ( filippo.io/nistec v0.0.4 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/BurntSushi/toml v1.5.0 // indirect github.com/DataDog/zstd v1.5.6 // indirect github.com/Khan/genqlient v0.8.1 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/NethermindEth/juno v0.12.5 // indirect github.com/NethermindEth/starknet.go v0.8.0 // indirect @@ -124,9 +101,8 @@ require ( github.com/andybalholm/brotli v1.2.0 // indirect github.com/apache/arrow-go/v18 v18.3.1 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/atombender/go-jsonschema v0.16.1-0.20240916205339-a74cd4e2851c // indirect + github.com/avast/retry-go v3.0.0+incompatible // indirect github.com/awalterschulze/gographviz v2.0.3+incompatible // indirect github.com/aws/aws-sdk-go v1.55.8 // indirect github.com/aws/aws-sdk-go-v2 v1.41.3 // indirect @@ -149,7 +125,6 @@ require ( github.com/aws/smithy-go v1.24.2 // indirect github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect - github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect github.com/beevik/ntp v1.5.0 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -168,7 +143,6 @@ require ( github.com/bytecodealliance/wasmtime-go/v28 v28.0.0 // indirect github.com/bytedance/sonic v1.12.3 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect - github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 // indirect github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.7.5 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect @@ -176,8 +150,6 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240821051457-da69c6d9617a // indirect - github.com/chzyer/readline v1.5.1 // indirect - github.com/cli/safeexec v1.0.0 // indirect github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.2 // indirect github.com/cloudevents/sdk-go/v2 v2.16.2 // indirect github.com/cloudwego/base64x v0.1.4 // indirect @@ -197,8 +169,6 @@ require ( github.com/containerd/log v0.1.0 // indirect github.com/containerd/platforms v1.0.0-rc.2 // indirect github.com/coreos/go-oidc/v3 v3.11.0 // indirect - github.com/coreos/go-semver v0.3.1 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.1.1 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect @@ -216,10 +186,8 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/siphash v1.2.3 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect - github.com/dennwc/varint v1.0.0 // indirect github.com/dgraph-io/badger/v4 v4.7.0 // indirect github.com/dgraph-io/ristretto/v2 v2.2.0 // indirect - github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/digital-asset/dazl-client/v8 v8.9.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/docker v28.5.2+incompatible // indirect @@ -230,7 +198,6 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect github.com/ebitengine/purego v0.10.0 // indirect - github.com/edsrzf/mmap-go v1.2.0 // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/esote/minmaxheap v1.0.0 // indirect @@ -239,7 +206,6 @@ require ( github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect github.com/expr-lang/expr v1.17.7 // indirect - github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect github.com/failsafe-go/failsafe-go v0.9.0 // indirect github.com/fatih/camelcase v1.0.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -270,19 +236,13 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-openapi/analysis v0.23.0 // indirect - github.com/go-openapi/errors v0.22.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect - github.com/go-openapi/loads v0.22.0 // indirect - github.com/go-openapi/spec v0.21.0 // indirect - github.com/go-openapi/strfmt v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/go-openapi/validate v0.24.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.30.1 // indirect - github.com/go-redsync/redsync/v4 v4.13.0 // indirect + github.com/go-resty/resty/v2 v2.17.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/go-webauthn/webauthn v0.9.4 // indirect github.com/go-webauthn/x v0.1.5 // indirect @@ -290,9 +250,7 @@ require ( github.com/goccy/go-yaml v1.19.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.12.1 // indirect - github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/gogo/status v1.1.1 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang/protobuf v1.5.4 // indirect @@ -304,27 +262,15 @@ require ( github.com/google/go-github/v72 v72.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-tpm v0.9.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect - github.com/google/s2a-go v0.1.9 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect - github.com/googleapis/gax-go/v2 v2.14.2 // indirect github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/sessions v1.2.2 // indirect github.com/gorilla/websocket v1.5.3 // indirect - github.com/grafana/dskit v0.0.0-20250617101305-c93a1bb09ecb // indirect - github.com/grafana/gomemcache v0.0.0-20250318131618-74242eea118d // indirect - github.com/grafana/grafana-foundation-sdk/go v0.0.0-20240326122733-6f96a993222b // indirect - github.com/grafana/jsonparser v0.0.0-20241004153430-023329977675 // indirect - github.com/grafana/loki/pkg/push v0.0.0-20250630054201-94c0ba7b0952 // indirect - github.com/grafana/loki/v3 v3.0.0-20250710111934-7be3efac7bc5 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.2.7 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect - github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect @@ -332,33 +278,23 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 // indirect - github.com/hashicorp/consul/api v1.32.1 // indirect github.com/hashicorp/consul/sdk v0.16.2 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-envparse v0.1.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.4 // indirect - github.com/hashicorp/go-msgpack/v2 v2.1.2 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.7.0 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect - github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/go-sockaddr v1.0.7 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/hashicorp/memberlist v0.5.3 // indirect - github.com/hashicorp/serf v0.10.2 // indirect github.com/hashicorp/yamux v0.1.2 // indirect github.com/hasura/go-graphql-client v0.15.1 // indirect github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.3.2 // indirect - github.com/huandu/xstrings v1.5.0 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -374,7 +310,6 @@ require ( github.com/jackc/pgtype v1.14.4 // indirect github.com/jackc/pgx/v4 v4.18.3 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/jaegertracing/jaeger-idl v0.5.0 // indirect github.com/jinzhu/copier v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect @@ -383,14 +318,10 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/klauspost/compress v1.18.4 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect - github.com/knadh/koanf/maps v0.1.2 // indirect - github.com/knadh/koanf/providers/confmap v0.1.0 // indirect - github.com/knadh/koanf/v2 v2.1.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect @@ -405,18 +336,14 @@ require ( github.com/marcboeker/go-duckdb v1.8.5 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mdlayher/socket v0.5.1 // indirect - github.com/mdlayher/vsock v1.2.1 // indirect github.com/mfridman/interpolate v0.0.2 // indirect github.com/miekg/dns v1.1.65 // indirect github.com/minio/sha256-simd v1.0.1 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/go-archive v0.2.0 // indirect github.com/moby/patternmatcher v0.6.0 // indirect @@ -428,26 +355,18 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect + github.com/montanaflynn/stats v0.7.1 // indirect github.com/morikuni/aec v1.1.0 // indirect github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/oapi-codegen/runtime v1.1.2 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.2.0 // indirect - github.com/oklog/ulid v1.3.1 // indirect - github.com/oklog/ulid/v2 v2.1.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.124.1 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.124.1 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.124.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/opentracing-contrib/go-grpc v0.1.2 // indirect - github.com/opentracing-contrib/go-stdlib v1.1.0 // indirect - github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect github.com/otiai10/copy v1.14.1 // indirect github.com/otiai10/mint v1.6.3 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect @@ -460,22 +379,13 @@ require ( github.com/pion/stun/v2 v2.0.0 // indirect github.com/pion/transport/v2 v2.2.10 // indirect github.com/pion/transport/v3 v3.0.1 // indirect - github.com/pires/go-proxyproto v0.7.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/pressly/goose/v3 v3.26.0 // indirect - github.com/prometheus/alertmanager v0.28.1 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/exporter-toolkit v0.14.0 // indirect - github.com/prometheus/otlptranslator v0.0.0-20250414121140-35db323fe9fb // indirect github.com/prometheus/procfs v0.16.1 // indirect - github.com/prometheus/prometheus v0.304.2 // indirect - github.com/prometheus/sigv4 v0.2.0 // indirect - github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect - github.com/redis/go-redis/v9 v9.10.0 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/rs/cors v1.11.1 // indirect @@ -486,16 +396,17 @@ require ( github.com/sanity-io/litter v1.5.5 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect - github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect - github.com/sercand/kuberesolver/v6 v6.0.0 // indirect + github.com/scylladb/go-reflectx v1.0.1 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shirou/gopsutil/v3 v3.24.3 // indirect github.com/shirou/gopsutil/v4 v4.26.2 // indirect + github.com/shopspring/decimal v1.4.0 // indirect github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect github.com/sirupsen/logrus v1.9.4 // indirect github.com/smartcontractkit/ccip-contract-examples/chains/evm v0.0.0-20260129135848-c86808ba5cb9 // indirect github.com/smartcontractkit/ccip-owner-contracts v0.1.0 // indirect + github.com/smartcontractkit/chainlink-automation v0.8.1 // indirect github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260323224438-d819cb3228e1 // indirect github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment v0.0.0-20260317185256-d5f7db87ae70 // indirect github.com/smartcontractkit/chainlink-ccip/deployment v0.0.0-20260317185256-d5f7db87ae70 // indirect @@ -531,8 +442,8 @@ require ( github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20251120172354-e8ec0386b06c // indirect github.com/smartcontractkit/wsrpc v0.8.5-0.20250502134807-c57d3d995945 // indirect - github.com/sony/gobreaker/v2 v2.1.0 // indirect github.com/spf13/cast v1.10.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stellar/go-stellar-sdk v0.1.0 // indirect github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 // indirect @@ -547,15 +458,11 @@ require ( github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect - github.com/tjhop/slog-gokit v0.1.4 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect - github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/ugorji/go/codec v1.2.12 // indirect - github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect github.com/urfave/cli/v2 v2.27.7 // indirect github.com/valyala/fastjson v1.6.10 // indirect github.com/vektah/gqlparser/v2 v2.5.19 // indirect @@ -571,31 +478,11 @@ require ( go.dedis.ch/fixbuf v1.0.3 // indirect go.dedis.ch/kyber/v3 v3.1.0 // indirect go.etcd.io/bbolt v1.4.2 // indirect - go.etcd.io/etcd/api/v3 v3.5.14 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect - go.etcd.io/etcd/client/v3 v3.5.14 // indirect go.mongodb.org/mongo-driver v1.17.2 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/collector/component v1.30.0 // indirect - go.opentelemetry.io/collector/confmap v1.30.0 // indirect - go.opentelemetry.io/collector/confmap/xconfmap v0.124.0 // indirect - go.opentelemetry.io/collector/consumer v1.30.0 // indirect - go.opentelemetry.io/collector/featuregate v1.30.0 // indirect - go.opentelemetry.io/collector/internal/telemetry v0.124.0 // indirect - go.opentelemetry.io/collector/pdata v1.35.0 // indirect - go.opentelemetry.io/collector/pipeline v0.124.0 // indirect - go.opentelemetry.io/collector/processor v1.30.0 // indirect - go.opentelemetry.io/collector/semconv v0.124.0 // indirect - go.opentelemetry.io/contrib/bridges/otelzap v0.10.0 // indirect - go.opentelemetry.io/contrib/bridges/prometheus v0.61.0 // indirect - go.opentelemetry.io/contrib/exporters/autoexport v0.61.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect - go.opentelemetry.io/contrib/propagators/jaeger v1.35.0 // indirect - go.opentelemetry.io/contrib/samplers/jaegerremote v0.30.0 // indirect go.opentelemetry.io/otel v1.42.0 // indirect - go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.12.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect @@ -603,7 +490,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/prometheus v0.58.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.13.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.36.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.36.0 // indirect @@ -615,11 +501,9 @@ require ( go.opentelemetry.io/otel/trace v1.42.0 // indirect go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - go.uber.org/goleak v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/ratelimit v0.3.1 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/arch v0.11.0 // indirect golang.org/x/mod v0.33.0 // indirect golang.org/x/net v0.50.0 // indirect @@ -632,7 +516,6 @@ require ( golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gonum.org/v1/gonum v0.17.0 // indirect - google.golang.org/api v0.241.0 // indirect google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 8201c16deff..57d5059c689 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -19,18 +19,12 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go/auth v0.16.2 h1:QvBAGFPLrDeoiNjyfVunhQ10HKNYuOwZ5noee0M5df4= -cloud.google.com/go/auth v0.16.2/go.mod h1:sRBas2Y1fB1vZTdurouM0AzuYQBMZinrUYL8EufhtEA= -cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= -cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= -cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -82,32 +76,14 @@ github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8af github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI= github.com/AlekSi/pointer v1.1.0/go.mod h1:y7BvfRI3wXPWKXEBhU71nbnIEEZX0QTSB2Bj48UJIZE= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0 h1:Gt0j3wceWMwPmiazCa8MzMA0MfhmPIz0Qp0FJ6qcM0U= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.18.0/go.mod h1:Ot/6aikWnKWi4l9QB7qVSwa8iMphQNqkWALMoNT3rzM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 h1:OVoM452qUFBrX+URdH3VpR299ma4kfom0yB0URYky9g= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0/go.mod h1:kUjrAo8bgEwLeZ/CmHqNl3Z/kPm7y6FKfxxK0izYUg4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 h1:FPKJS1T+clwv+OLGt13a8UjqeRuh0O4SJ3lUriThc+4= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1/go.mod h1:j2chePtV91HrC22tGoRX3sGY42uF13WzmmV80/OdVAA= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 h1:LkHbJbgF3YyvC53aqYGR+wWQDn2Rdp9AQdGndf9QvY4= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0/go.mod h1:QyiQdW4f4/BIfB8ZutZ2s+28RAgfa/pT+zS++ZHyM1I= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3.0 h1:bXwSugBiSbgtz7rOtbfGf+woewp4f06orW9OP5BjHLA= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3.0/go.mod h1:Y/HgrePTmGy9HjdSGTqZNa+apUpTVIEVKXJyARP2lrk= github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Code-Hex/go-generics-cache v1.5.1 h1:6vhZGc5M7Y/YD8cIUcY8kcuQLB4cHR7U+0KMqAA0KcU= -github.com/Code-Hex/go-generics-cache v1.5.1/go.mod h1:qxcC9kRVrct9rHeiYpFWSoW1vxyillCVzX13KZG8dl4= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= @@ -116,27 +92,19 @@ github.com/Depado/ginprom v1.8.0 h1:zaaibRLNI1dMiiuj1MKzatm8qrcHzikMlCc1anqOdyo= github.com/Depado/ginprom v1.8.0/go.mod h1:XBaKzeNBqPF4vxJpNLincSQZeMDnZp1tIbU0FU0UKgg= github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0= -github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs= github.com/Khan/genqlient v0.8.1/go.mod h1:R2G6DzjBvCbhjsEajfRjbWdVglSH/73kSivC9TLWVjU= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= -github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= -github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/NethermindEth/juno v0.12.5 h1:a+KYQg8MxzNJIbbqGHq+vU9nTyuWu3acbyXxcUPUDOY= github.com/NethermindEth/juno v0.12.5/go.mod h1:XonWmZVRwCVHv1gjoVCoTFiZnYObwdukpd3NCsl04bA= github.com/NethermindEth/starknet.go v0.8.0 h1:mGh7qDWrvuXJPcgGJP31DpifzP6+Ef2gt/BQhaqsV40= github.com/NethermindEth/starknet.go v0.8.0/go.mod h1:slNA8PxtxA/0LQv0FwHnL3lHFDNhVZfTK6U2gjVb7l8= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 h1:1zYrtlhrZ6/b6SAjLSfKzWtdgqK0U+HtH/VcBWh1BaU= github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI= @@ -147,8 +115,6 @@ github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMG github.com/VictoriaMetrics/fastcache v1.13.0/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.1.5 h1:5YfhQ4ry7bZc2Mc7R0YZyYwpf5c6t1cEFvdAhd6Mkf4= -github.com/Workiva/go-datastructures v1.1.5/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/XSAM/otelsql v0.37.0 h1:ya5RNw028JW0eJW8Ma4AmoKxAYsJSGuNVbC7F1J457A= github.com/XSAM/otelsql v0.37.0/go.mod h1:LHbCu49iU8p255nCn1oi04oX2UjSoRcUMiKEHo2a5qM= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -162,9 +128,6 @@ github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vS github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= -github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= -github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= -github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg= @@ -185,13 +148,10 @@ github.com/archseer/binary v0.0.0-20250226104222-b87d7f4fd58a h1:2/4CQPSQ5LAAJHR github.com/archseer/binary v0.0.0-20250226104222-b87d7f4fd58a/go.mod h1:2tfj51g5o9dnvsc+fL3Jxr22MuWzYXwx9wEoN0XQ7/c= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/atombender/go-jsonschema v0.16.1-0.20240916205339-a74cd4e2851c h1:cxQVoh6kY+c4b0HUchHjGWBI8288VhH50qxKG3hdEg0= github.com/atombender/go-jsonschema v0.16.1-0.20240916205339-a74cd4e2851c/go.mod h1:3XzxudkrYVUvbduN/uI2fl4lSrMSzU0+3RCu2mpnfx8= github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= @@ -244,14 +204,10 @@ github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM= -github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 h1:6df1vn4bBlDDo4tARvBm7l6KA9iVMnE3NWizDeWSrps= -github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3/go.mod h1:CIWtjkly68+yqLPbvwwR/fjNJA/idrtULjZWh2v1ys0= github.com/beevik/ntp v1.5.0 h1:y+uj/JjNwlY2JahivxYvtmv4ehfi3h74fAuABB9ZSM4= github.com/beevik/ntp v1.5.0/go.mod h1:mJEhBrwT76w9D+IfOEGvuzyuudiW9E52U2BaTrMOYow= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -275,10 +231,6 @@ github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox github.com/block-vision/sui-go-sdk v1.1.4 h1:1PPgYxQjo1P9UCgFOPTvDCuGEglRL32NwjKPulR4FQk= github.com/block-vision/sui-go-sdk v1.1.4/go.mod h1:t8mWASwfyv+EyqHGO9ZrcDiCJWGOFEXqq50TMJ8GQco= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= -github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= -github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= -github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= -github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= @@ -326,8 +278,6 @@ github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKz github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 h1:6lhrsTEnloDPXyeZBvSYvQf8u86jbKehZPVDDlkgDl4= -github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.7.5 h1:rvc39Ol6z3MvaBzXkxFC6Nfsnixq/dRypushKDd7Nc0= github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.7.5/go.mod h1:R/pdNYDYFQk+tuuOo7QES1kkv6OLmp5ze2XBZQIVffM= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -347,33 +297,11 @@ github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNS github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHeQQ+5AjwawxA= github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240821051457-da69c6d9617a h1:6Pg3a6j/41QDzH/oYcMLwwKsf3x/HXcu9W/dBaf2Hzs= github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240821051457-da69c6d9617a/go.mod h1:x11iCbZV6hzzSQWMq610B6Wl5Lg1dhwqcVfeiWQQnQQ= -github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= -github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= -github.com/charmbracelet/lipgloss v1.1.1-0.20250319133953-166f707985bc h1:nFRtCfZu/zkltd2lsLUPlVNv3ej/Atod9hcdbRZtlys= -github.com/charmbracelet/lipgloss v1.1.1-0.20250319133953-166f707985bc/go.mod h1:aKC/t2arECF6rNOnaKaVU6y4t4ZeHQzqfxedE/VkVhA= -github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= -github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= -github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k= -github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= -github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= -github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= -github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= -github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/cli/go-gh/v2 v2.13.0 h1:jEHZu/VPVoIJkciK3pzZd3rbT8J90swsK5Ui4ewH1ys= -github.com/cli/go-gh/v2 v2.13.0/go.mod h1:Us/NbQ8VNM0fdaILgoXSz6PKkV5PWaEzkJdc9vR2geM= -github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI= -github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= -github.com/cli/shurcooL-graphql v0.0.4 h1:6MogPnQJLjKkaXPyGqPRXOI2qCsQdqNfUY1QSJu2GuY= -github.com/cli/shurcooL-graphql v0.0.4/go.mod h1:3waN4u02FiZivIV+p1y4d0Jo1jc6BViMA73C+sZo2fk= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.2 h1:ydUjnKn4RoCeN8rge3F/deT52w2WJMmIC5mHNUq+Ut8= github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.16.2/go.mod h1:Bny999RuVUtNjzTGa9HCHpXjrLGMipJVq5kqVpudBl0= @@ -386,8 +314,6 @@ github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w= -github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= @@ -414,8 +340,6 @@ github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 h1:icCHutJouWlQREayFwCc7lxD github.com/confluentinc/confluent-kafka-go/v2 v2.3.0/go.mod h1:/VTy8iEpe6mD9pkCH5BhijlUl8ulUXymKv1Qig5Rgb8= github.com/consensys/gnark-crypto v0.19.2 h1:qrEAIXq3T4egxqiliFFoNrepkIWVEeIYwt3UL0fvS80= github.com/consensys/gnark-crypto v0.19.2/go.mod h1:rT23F0XSZqE0mUA0+pRtnL56IbPxs6gp4CeRsBk4XS0= -github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= -github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= @@ -429,12 +353,9 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI= github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= -github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= @@ -503,8 +424,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjY github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= -github.com/dennwc/varint v1.0.0 h1:kGNFFSSw8ToIy3obO/kKr8U9GZYUAxQEVuix4zfDWzE= -github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dfuse-io/logging v0.0.0-20210109005628-b97a57253f70/go.mod h1:EoK/8RFbMEteaCaz89uessDTnCWjbbcr+DXcBh4el5o= @@ -515,13 +434,9 @@ github.com/dgraph-io/ristretto/v2 v2.2.0/go.mod h1:RZrm63UmcBAaYWC1DotLYBmTvgkrs github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/digital-asset/dazl-client/v8 v8.9.0 h1:F2qTUWtHAjhGyRGV+xTim+VAFwM99FpcOx4+wowvPnY= github.com/digital-asset/dazl-client/v8 v8.9.0/go.mod h1:q1KevCJ8FpH8je2MnnjN8/QUfhstB4fKpyKyqDtqFh0= -github.com/digitalocean/godo v1.144.0 h1:rDCsmpwcDe5egFQ3Ae45HTde685/GzX037mWRMPufW0= -github.com/digitalocean/godo v1.144.0/go.mod h1:tYeiWY5ZXVpU48YaFv0M5irUFHXGorZpDNm7zzdWMzM= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM= @@ -540,8 +455,6 @@ github.com/dvsekhvalnov/jose2go v1.7.0 h1:bnQc8+GMnidJZA8zc6lLEAb4xNrIqHwO+9Tzqv github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/edsrzf/mmap-go v1.2.0 h1:hXLYlkbaPzt1SaQk+anYwKSRNhufIDCchSPkUD6dD84= -github.com/edsrzf/mmap-go v1.2.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= @@ -552,12 +465,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= -github.com/envoyproxy/go-control-plane/envoy v1.36.0 h1:yg/JjO5E7ubRyKX3m07GF3reDNEnfOboJ0QySbH736g= -github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4= -github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA= github.com/esote/minmaxheap v1.0.0 h1:rgA7StnXXpZG6qlM0S7pUmEv1KpWe32rYT4x8J8ntaA= github.com/esote/minmaxheap v1.0.0/go.mod h1:Ln8+i7fS1k3PLgZI2JAo0iA1as95QnIYiGCrqSJ5FZk= github.com/ethereum/c-kzg-4844/v2 v2.1.6 h1:xQymkKCT5E2Jiaoqf3v4wsNgjZLY0lRSkZn27fRjSls= @@ -574,8 +482,6 @@ github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f h1:Wl78ApPPB2 github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f/go.mod h1:OSYXu++VVOHnXeitef/D8n/6y4QV8uLHSFXX4NeXMGc= github.com/expr-lang/expr v1.17.7 h1:Q0xY/e/2aCIp8g9s/LGvMDCC5PxYlvHgDZRQ4y16JX8= github.com/expr-lang/expr v1.17.7/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= -github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb h1:IT4JYU7k4ikYg1SCxNI1/Tieq/NFvh6dzLdgi7eu0tM= -github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb/go.mod h1:bH6Xx7IW64qjjJq8M2u4dxNaBiDfKK+z/3eGDpXEQhc= github.com/failsafe-go/failsafe-go v0.9.0 h1:w0g7iv48RpQvV3UH1VlgUnLx9frQfCwI7ljnJzqEhYg= github.com/failsafe-go/failsafe-go v0.9.0/go.mod h1:sX5TZ4HrMLYSzErWeckIHRZWgZj9PbKMAEKOVLFWtfM= github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= @@ -678,24 +584,12 @@ github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= -github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= -github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= -github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= -github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= -github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= -github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= -github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= -github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= -github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= -github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -704,14 +598,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w= github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM= -github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= -github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI= -github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= -github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= -github.com/go-redsync/redsync/v4 v4.13.0 h1:49X6GJfnbLGaIpBBREM/zA4uIMDXKAh1NDkvQ1EkZKA= -github.com/go-redsync/redsync/v4 v4.13.0/go.mod h1:HMW4Q224GZQz6x1Xc7040Yfgacukdzu7ifTDAKiyErQ= github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk= github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= @@ -730,8 +616,6 @@ github.com/go-webauthn/webauthn v0.9.4 h1:YxvHSqgUyc5AK2pZbqkWWR55qKeDPhP8zLDr6l github.com/go-webauthn/webauthn v0.9.4/go.mod h1:LqupCtzSef38FcxzaklmOn7AykGKhAhr9xlRbdbgnTw= github.com/go-webauthn/x v0.1.5 h1:V2TCzDU2TGLd0kSZOXdrqDVV5JB9ILnKxA9S53CSBw0= github.com/go-webauthn/x v0.1.5/go.mod h1:qbzWwcFcv4rTwtCLOZd+icnr6B7oSsAGZJqlt8cukqY= -github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I= -github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= @@ -744,15 +628,12 @@ github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeH github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/gogo/status v1.1.1 h1:DuHXlSFHNKqTQ+/ACf5Vs6r4X/dH2EgIzR9Vr+H65kg= -github.com/gogo/status v1.1.1/go.mod h1:jpG3dM5QPcqu19Hg8lkUhBFBa3TcLs1DG7+2Jqci7oU= github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= @@ -795,8 +676,6 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= @@ -852,22 +731,14 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= -github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4= -github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.14.2 h1:eBLnkZ9635krYIPD+ag1USrOAI0Nr0QYF3+/3GqO0k0= -github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w= -github.com/gophercloud/gophercloud/v2 v2.7.0 h1:o0m4kgVcPgHlcXiWAjoVxGd8QCmvM5VU+YM71pFbn0E= -github.com/gophercloud/gophercloud/v2 v2.7.0/go.mod h1:Ki/ILhYZr/5EPebrPL9Ej+tUg4lqx71/YH2JWVeU+Qk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= @@ -887,26 +758,12 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grafana/dskit v0.0.0-20250617101305-c93a1bb09ecb h1:jQ5UjRFq1xdRC+Mr60mix44jBJGVQ/jUOEDkXuYR5kc= -github.com/grafana/dskit v0.0.0-20250617101305-c93a1bb09ecb/go.mod h1:JO5e0gs13dzqKYIF5cSa5YCNU5ydrziLP6dDzw0mPqc= -github.com/grafana/gomemcache v0.0.0-20250318131618-74242eea118d h1:oXRJlb9UjVsl6LhqBdbyAQ9YFhExwsj4bjh5vwMNRZY= -github.com/grafana/gomemcache v0.0.0-20250318131618-74242eea118d/go.mod h1:j/s0jkda4UXTemDs7Pgw/vMT06alWc42CHisvYac0qw= -github.com/grafana/grafana-foundation-sdk/go v0.0.0-20240326122733-6f96a993222b h1:Msqs1nc2qWMxTriDCITKl58Td+7Md/RURmUmH7RXKns= -github.com/grafana/grafana-foundation-sdk/go v0.0.0-20240326122733-6f96a993222b/go.mod h1:WtWosval1KCZP9BGa42b8aVoJmVXSg0EvQXi9LDSVZQ= -github.com/grafana/jsonparser v0.0.0-20241004153430-023329977675 h1:U94jQ2TQr1m3HNyE8efSdyaBbDrdPaWImXyenuKZ/nw= -github.com/grafana/jsonparser v0.0.0-20241004153430-023329977675/go.mod h1:796sq+UcONnSlzA3RtlBZ+b/hrerkZXiEmO8oMjyRwY= -github.com/grafana/loki/pkg/push v0.0.0-20250630054201-94c0ba7b0952 h1:rLzoJGDnoXsZV2j/2atL6OVk9AHluTbDOD8Ls9trtIA= -github.com/grafana/loki/pkg/push v0.0.0-20250630054201-94c0ba7b0952/go.mod h1:ny/0bFitf8KNZkZfweaI4hmwb5XPhaFD2d0kVcyKmjo= -github.com/grafana/loki/v3 v3.0.0-20250710111934-7be3efac7bc5 h1:SbcssA14Xxg/0e/EPYuTBgJlgjCjcNG25NWty0pyOdM= -github.com/grafana/loki/v3 v3.0.0-20250710111934-7be3efac7bc5/go.mod h1:NOlx6BZ8Bwqs1F0H/4One6OO1/yJUl9oVgpwIIvL+Pk= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.2.7 h1:VWBBlqxjyR0Cwk2W6UrE8CdcdD80GOFNutj0Kb1T8ac= github.com/grafana/pyroscope-go v1.2.7/go.mod h1:o/bpSLiJYYP6HQtvcoVKiE9s5RiNgjYTj1DhiddP2Pc= github.com/grafana/pyroscope-go/godeltaprof v0.1.9 h1:c1Us8i6eSmkW+Ez05d3co8kasnuOY813tbMN8i/a3Og= github.com/grafana/pyroscope-go/godeltaprof v0.1.9/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= -github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= -github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/graph-gophers/dataloader v5.0.0+incompatible h1:R+yjsbrNq1Mo3aPG+Z/EKYrXrXXUNJHOgbRt+U6jOug= github.com/graph-gophers/dataloader v5.0.0+incompatible/go.mod h1:jk4jk0c5ZISbKaMe8WsVopGB5/15GvGHMdMdPtwlRp4= github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= @@ -931,16 +788,10 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NM github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.32.1 h1:0+osr/3t/aZNAdJX558crU3PEjVrG4x6715aZHRgceE= -github.com/hashicorp/consul/api v1.32.1/go.mod h1:mXUWLnxftwTmDv4W3lzxYCPD199iNLLUyLfLGFJbtl4= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.16.2 h1:cGX/djeEe9r087ARiKVWwVWCF64J+yW0G6ftZMZYbj0= github.com/hashicorp/consul/sdk v0.16.2/go.mod h1:onxcZjYVsPx5XMveAC/OtoIsdr32fykB7INFltDoRE8= -github.com/hashicorp/cronexpr v1.1.2 h1:wG/ZYIKT+RT3QkOdgYc+xsKWVRgnxJ1OJtjjy84fJ9A= -github.com/hashicorp/cronexpr v1.1.2/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -959,29 +810,19 @@ github.com/hashicorp/go-memdb v1.3.5/go.mod h1:8IVKKBkVe+fxFgdFOYxzQQNjz+sWCyHCd github.com/hashicorp/go-metrics v0.5.4 h1:8mmPiIJkTPPEbAiV97IxdAGNdRdaWwVap1BU6elejKY= github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv4lxZ350i+QQI= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-msgpack/v2 v2.1.2 h1:4Ee8FTp834e+ewB71RDrQ0VKpyFdrKOjvYtnQ/ltVj0= -github.com/hashicorp/go-msgpack/v2 v2.1.2/go.mod h1:upybraOAblm4S7rx0+jeNy+CWWhzywQsSRV5033mMu4= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA= github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.7 h1:G+pTkSO01HpR5qCxg7lxfsFEZaG+C0VssTy/9dbT+Fw= -github.com/hashicorp/go-sockaddr v1.0.7/go.mod h1:FZQbEYa1pxkQ7WLpyXJ6cbjpT8q0YgQaK/JakXqGyWw= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -994,23 +835,13 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.5.3 h1:tQ1jOCypD0WvMemw/ZhhtH+PWpzcftQvgCorLu0hndk= -github.com/hashicorp/memberlist v0.5.3/go.mod h1:h60o12SZn/ua/j0B6iKAZezA4eDaGsIuPO70eOaJ6WE= -github.com/hashicorp/nomad/api v0.0.0-20241218080744-e3ac00f30eec h1:+YBzb977VrmffaCX/OBm17dEVJUcWn5dW+eqs3aIJ/A= -github.com/hashicorp/nomad/api v0.0.0-20241218080744-e3ac00f30eec/go.mod h1:svtxn6QnrQ69P23VvIWMR34tg3vmwLz4UdUzm1dSCgE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/serf v0.10.2 h1:m5IORhuNSjaxeljg5DeQVDlQyVkhRIjJDimbkCa8aAc= -github.com/hashicorp/serf v0.10.2/go.mod h1:T1CmSGfSeGfnfNy/w0odXQUR1rfECGd2Qdsp84DjOiY= github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/hasura/go-graphql-client v0.15.1 h1:mCb5I+8Bk3FU3GKWvf/zDXkTh7FbGlqJmP3oisBdnN8= github.com/hasura/go-graphql-client v0.15.1/go.mod h1:jfSZtBER3or+88Q9vFhWHiFMPppfYILRyl+0zsgPIIw= github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/henvic/httpretty v0.0.6 h1:JdzGzKZBajBfnvlMALXXMVQWxWMF/ofTy8C3/OSUTxs= -github.com/henvic/httpretty v0.0.6/go.mod h1:X38wLjWXHkXT7r2+uK8LjCMne9rsuNaBLJ+5cU2/Pmo= -github.com/hetznercloud/hcloud-go/v2 v2.21.0 h1:wUpQT+fgAxIcdMtFvuCJ78ziqc/VARubpOQPQyj4Q84= -github.com/hetznercloud/hcloud-go/v2 v2.21.0/go.mod h1:WSM7w+9tT86sJTNcF8a/oHljC3HUmQfcLxYsgx6PpSc= github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db h1:IZUYC/xb3giYwBLMnr8d0TGTzPKFGNTCGgGLoyeX330= github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db/go.mod h1:xTEYN9KCHxuYHs+NmrmzFcnvHMzLLNiGFafCb1n3Mfg= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= @@ -1020,8 +851,6 @@ github.com/holiman/uint256 v1.3.2/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXei github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= -github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= -github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= @@ -1045,8 +874,6 @@ github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b h1:i44CesU68Z github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b/go.mod h1:Z0kXnxzbTC2qrx4NaIzYkE1k66+6oEDQTvL95hQFh5Y= github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E= github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= -github.com/ionos-cloud/sdk-go/v6 v6.3.3 h1:q33Sw1ZqsvqDkFaKG53dGk7BCOvPCPbGZpYqsF6tdjw= -github.com/ionos-cloud/sdk-go/v6 v6.3.3/go.mod h1:wCVwNJ/21W29FWFUv+fNawOTMlFoP1dS3L+ZuztFW48= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -1100,8 +927,6 @@ github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dv github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jaegertracing/jaeger-idl v0.5.0 h1:zFXR5NL3Utu7MhPg8ZorxtCBjHrL3ReM1VoB65FOFGE= -github.com/jaegertracing/jaeger-idl v0.5.0/go.mod h1:ON90zFo9eoyXrt9F/KN8YeF3zxcnujaisMweFY/rg5k= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= @@ -1138,14 +963,11 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52 h1:msKODTL1m0wigztaqILOtla9HeW1ciscYG4xjLtvk5I= github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52/go.mod h1:qk1sX/IBgppQNcGCRoj90u6EGC056EBoIc1oEjCWla8= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU= -github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -1159,15 +981,7 @@ github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxh github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= -github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= -github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= -github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= -github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= -github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= -github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1199,16 +1013,12 @@ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhn github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg= github.com/linkedin/goavro/v2 v2.12.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk= -github.com/linode/linodego v1.49.0 h1:MNd3qwvQzbXB5mCpvdCqlUIu1RPA9oC+50LyB9kK+GQ= -github.com/linode/linodego v1.49.0/go.mod h1:B+HAM3//4w1wOS0BwdaQBKwBxlfe6kYJ7bSC6jJ/xtc= github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY= github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 h1:PTw+yKnXcOFCR6+8hHTyWBeQ/P4Nb7dd4/0ohEcWQuM= github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= @@ -1218,8 +1028,6 @@ github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8S github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/manucorporat/sse v0.0.0-20160126180136-ee05b128a739 h1:ykXz+pRRTibcSjG1yRhpdSHInF8yZY/mfn+Rz2Nd1rE= github.com/manucorporat/sse v0.0.0-20160126180136-ee05b128a739/go.mod h1:zUx1mhth20V3VKgL5jbd1BSQcW4Fy6Qs4PZvQwRFwzM= github.com/manyminds/api2go v0.0.0-20171030193247-e7b693844a6f h1:tVvGiZQFjOXP+9YyGqSA6jE55x1XVxmoPYudncxrZ8U= @@ -1254,10 +1062,6 @@ github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxU github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos= -github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ= -github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ= -github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -1273,8 +1077,6 @@ github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0 github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -1292,8 +1094,6 @@ github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 h1:BpfhmL github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= @@ -1331,10 +1131,6 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= -github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -1357,10 +1153,7 @@ github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dl github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/oklog/ulid/v2 v2.1.0 h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU= -github.com/oklog/ulid/v2 v2.1.0/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -1381,41 +1174,21 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.124.1 h1:jOG1ceAx+IATloKXHsE2Cy88XTgqPB/hiXicOrxENx8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.124.1/go.mod h1:mtNCoy09iO1f2zy5bEqkyRfRPaNKea57yK63cfHixts= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.124.1 h1:G2daAIXiQhAwQSz9RK71QsBH9rmH/m/vdkFuGIEPfS4= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.124.1/go.mod h1:/WAA1PKvHNz7E5SrtGg2KfAWl/PrmS0FVYOanoGxk0I= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.124.1 h1:mMVzpkpy6rKL1Q/xXNogZVtWebIlxTRzhsgp3b9ioCM= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.124.1/go.mod h1:jM8Gsd0fIiwRzWrzd7Gm6PZYi5AgHPRkz0625Rtqyxo= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.124.1 h1:gmmzhgewk2fU0Md0vmaDEFgfRycfCfjgPvMA4SEdKiU= -github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.124.1/go.mod h1:AsQJBuUUY1/yqK2c87hv4deeteaKwktwLIfQCN2OGk4= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= -github.com/opentracing-contrib/go-grpc v0.1.2 h1:MP16Ozc59kqqwn1v18aQxpeGZhsBanJ2iurZYaQSZ+g= -github.com/opentracing-contrib/go-grpc v0.1.2/go.mod h1:glU6rl1Fhfp9aXUHkE36K2mR4ht8vih0ekOVlWKEUHM= -github.com/opentracing-contrib/go-stdlib v1.1.0 h1:cZBWc4pA4e65tqTJddbflK435S0tDImj6c9BMvkdUH0= -github.com/opentracing-contrib/go-stdlib v1.1.0/go.mod h1:S0p+X9p6dcBkoMTL+Qq2VOvxKs9ys5PpYWXWqlCS0bQ= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b/go.mod h1:AC62GU6hc0BrNm+9RK9VSiwa/EUe1bkIeFORAMcHvJU= -github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/otiai10/copy v1.14.1 h1:5/7E6qsUMBaH5AnQ0sSLzzTg1oTECmcCmT6lvF45Na8= github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I= github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs= github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= -github.com/ovh/go-ovh v1.7.0 h1:V14nF7FwDjQrZt9g7jzcvAAQ3HN6DNShRFRMC3jLoPw= -github.com/ovh/go-ovh v1.7.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -1445,18 +1218,12 @@ github.com/pion/transport/v2 v2.2.10 h1:ucLBLE8nuxiHfvkFKnkDQRYWYfp8ejf4YBOPfaQp github.com/pion/transport/v2 v2.2.10/go.mod h1:sq1kSLWs+cHW9E+2fJP95QudkzbK7wscs8yYgQToO5E= github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= -github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs= -github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= @@ -1467,8 +1234,6 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM= github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= -github.com/prometheus/alertmanager v0.28.1 h1:BK5pCoAtaKg01BYRUJhEDV1tqJMEtYBGzPw8QdvnnvA= -github.com/prometheus/alertmanager v0.28.1/go.mod h1:0StpPUDDHi1VXeM7p2yYfeZgLVi/PPlt39vo9LQUHxM= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -1491,10 +1256,6 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/exporter-toolkit v0.14.0 h1:NMlswfibpcZZ+H0sZBiTjrA3/aBFHkNZqE+iCj5EmRg= -github.com/prometheus/exporter-toolkit v0.14.0/go.mod h1:Gu5LnVvt7Nr/oqTBUC23WILZepW0nffNo10XdhQcwWA= -github.com/prometheus/otlptranslator v0.0.0-20250414121140-35db323fe9fb h1:wuS7VydG/rDWTbYMp07paPv3R1hiPC9WgingWs+xgi0= -github.com/prometheus/otlptranslator v0.0.0-20250414121140-35db323fe9fb/go.mod h1:M7gjuJF83qnpgElJIPfhiK+YAHlvot5epcAV+Rie7eo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1505,19 +1266,11 @@ github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzM github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/prometheus/prometheus v0.304.2 h1:HhjbaAwet87x8Be19PFI/5W96UMubGy3zt24kayEuh4= github.com/prometheus/prometheus v0.304.2/go.mod h1:ioGx2SGKTY+fLnJSQCdTHqARVldGNS8OlIe3kvp98so= -github.com/prometheus/sigv4 v0.2.0 h1:qDFKnHYFswJxdzGeRP63c4HlH3Vbn1Yf/Ao2zabtVXk= -github.com/prometheus/sigv4 v0.2.0/go.mod h1:D04rqmAaPPEUkjRQxGqjoxdyJuyCh6E0M18fZr0zBiE= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prysmaticlabs/gohashtree v0.0.4-beta h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4= github.com/prysmaticlabs/gohashtree v0.0.4-beta/go.mod h1:BFdtALS+Ffhg3lGQIHv9HDWuHS8cTvHZzrHWxwOtGOs= -github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg= -github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs= -github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= -github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo= -github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/riferrei/srclient v0.5.4 h1:dfwyR5u23QF7beuVl2WemUY2KXh5+Sc4DHKyPXBNYuc= @@ -1558,18 +1311,13 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPO github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33 h1:KhF0WejiUTDbL5X55nXowP7zNopwpowa6qaMAWyIE+0= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33/go.mod h1:792k1RTU+5JeMXm35/e2Wgp71qPH/DmDoZrRc+EFZDk= github.com/scylladb/go-reflectx v1.0.1 h1:b917wZM7189pZdlND9PbIJ6NQxfDPfBvUaQ7cjj1iZQ= github.com/scylladb/go-reflectx v1.0.1/go.mod h1:rWnOfDIRWBGN0miMLIcoPt/Dhi2doCMZqwMCJ3KupFc= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/go-loggly v0.5.1-0.20171222203950-eb91657e62b2 h1:S4OC0+OBKz6mJnzuHioeEat74PuQ4Sgvbf8eus695sc= github.com/segmentio/go-loggly v0.5.1-0.20171222203950-eb91657e62b2/go.mod h1:8zLRYR5npGjaOXgPSKat5+oOh+UHd8OdbS18iqX9F6Y= github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= -github.com/sercand/kuberesolver/v6 v6.0.0 h1:ScvS2Ga9snVkpOahln/BCLySr3/iBAHJf25u66DweZ0= -github.com/sercand/kuberesolver/v6 v6.0.0/go.mod h1:Dxkqms3OJadP5zirIBPLi9FV8Qpys3T3w40XPEcVsu0= github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= @@ -1694,20 +1442,14 @@ github.com/smartcontractkit/chainlink-sui/deployment v0.0.0-20260304150206-c64e4 github.com/smartcontractkit/chainlink-sui/deployment v0.0.0-20260304150206-c64e48eb0cb0/go.mod h1:IfeW6t5Yc5293H5ixuooAft+wYBMSFQWKjbBTwYiKr4= github.com/smartcontractkit/chainlink-testing-framework/framework v0.15.3 h1:wMxGJzQrKF5J9Msmpeal1Iw3h4RqPwOZ2I1ZjlSqhZo= github.com/smartcontractkit/chainlink-testing-framework/framework v0.15.3/go.mod h1:BALK9cj8sk12e15UF6uDhifHgIApa+6N11TcQfInEro= -github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.5 h1:S5HND0EDtlA+xp2E+mD11DlUTp2wD6uojwixye8ZB/k= -github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.5/go.mod h1:SKBYQvtnl3OqOTr5aQyt9YbIckuNNn40LOJUCR0vlMo= github.com/smartcontractkit/chainlink-testing-framework/lib v1.54.7 h1:6dmdg2tppPKEFuEwBcT1kSEHj5Uj1xrWnKqX0wZg7zo= github.com/smartcontractkit/chainlink-testing-framework/lib v1.54.7/go.mod h1:dgwtcefGr+0i+C2S6V/Xgntzm7E5CPxXMyi2OnQvnHI= -github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.51.0 h1:+6L/PVxWsaYCr9jmxtKfyCcEJm1o6UaKrFJU9jAiZwA= -github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.51.0/go.mod h1:ym1yBKknQkGfgSQF7EGXSevDuex1YZbz+zgDwRvhY3U= github.com/smartcontractkit/chainlink-testing-framework/parrot v0.6.2 h1:cWUHB6QETyKbmh0B988f5AKIKb3aBDWugfrZ04jAUUY= github.com/smartcontractkit/chainlink-testing-framework/parrot v0.6.2/go.mod h1:Z4K5VJLjsfqIIaBcZ1Sfccxu0xsCxBjPa6zF+5gtQaM= github.com/smartcontractkit/chainlink-testing-framework/sentinel v0.1.2 h1:ihRlWrii5nr4RUuMu1hStTbwFvVuHUDoQQwXmCU5IdQ= github.com/smartcontractkit/chainlink-testing-framework/sentinel v0.1.2/go.mod h1:J1Za5EuI/vWDsQSIh6qbPXlVvuEhmHmnvLQBN0XVxqA= github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5 h1:RwZXxdIAOyjp6cwc9Quxgr38k8r7ACz+Lxh9o/A6oH0= github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5/go.mod h1:kHYJnZUqiPF7/xN5273prV+srrLJkS77GbBXHLKQpx0= -github.com/smartcontractkit/chainlink-testing-framework/wasp v1.51.2 h1:QFO9Ar1zY9SHj//7LXWq5caVrfyTFrkRcfkMQeSOAaQ= -github.com/smartcontractkit/chainlink-testing-framework/wasp v1.51.2/go.mod h1:OLczwaAvyObFG+eq4tQHkWqkbPBB0cHkZj0JzY3inik= github.com/smartcontractkit/chainlink-ton v0.0.0-20260318210736-c3f360fd19a8 h1:TAa3dDeNpkR263GdXiH1hKEBev1btXLxDPnhP6VfFDY= github.com/smartcontractkit/chainlink-ton v0.0.0-20260318210736-c3f360fd19a8/go.mod h1:xvvqQRZ0jlM++hn7DWs4eGH5F5hpjj3UQva5nfCoj94= github.com/smartcontractkit/chainlink-ton/deployment v0.0.0-20260318210736-c3f360fd19a8 h1:vSc4tLr6jv+I7+tdkrclI4d9pCEMt7eVNXdpufziOwU= @@ -1741,8 +1483,6 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker/v2 v2.1.0 h1:av2BnjtRmVPWBvy5gSFPytm1J8BmN5AGhq875FfGKDM= -github.com/sony/gobreaker/v2 v2.1.0/go.mod h1:dO3Q/nCzxZj6ICjH6J/gM0r4oAwBMVLY8YAQf+NTtUg= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1802,8 +1542,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM= -github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= @@ -1824,8 +1562,6 @@ github.com/testcontainers/testcontainers-go/modules/postgres v0.41.0 h1:AOtFXssr github.com/testcontainers/testcontainers-go/modules/postgres v0.41.0/go.mod h1:k2a09UKhgSp6vNpliIY0QSgm4Hi7GXVTzWvWgUemu/8= github.com/theodesp/go-heaps v0.0.0-20190520121037-88e35354fe0a h1:YuO+afVc3eqrjiCUizNCxI53bl/BnPiVwXqLzqYTqgU= github.com/theodesp/go-heaps v0.0.0-20190520121037-88e35354fe0a/go.mod h1:/sfW47zCZp9FrtGcWyo1VjbgDaodxX9ovZvgLb/MxaA= -github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e h1:BuzhfgfWQbX0dWzYzT1zsORLnHRv3bcRcsaUk0VmXA8= -github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -1838,8 +1574,6 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/tjhop/slog-gokit v0.1.4 h1:uj/vbDt3HaF0Py8bHPV4ti/s0utnO0miRbO277FLBKM= -github.com/tjhop/slog-gokit v0.1.4/go.mod h1:Bbu5v2748qpAWH7k6gse/kw3076IJf6owJmh7yArmJs= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= @@ -1852,10 +1586,6 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= -github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= -github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA= @@ -1877,8 +1607,6 @@ github.com/valyala/fastjson v1.6.10/go.mod h1:e6FubmQouUNP73jtMLmcbxS6ydWIpOfhz3 github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/vektah/gqlparser/v2 v2.5.19 h1:bhCPCX1D4WWzCDvkPl4+TP1N8/kLrWnp43egplt7iSg= github.com/vektah/gqlparser/v2 v2.5.19/go.mod h1:y7kvl5bBlDeuWIvLtA9849ncyvx6/lj06RsMrEjVy3U= -github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs= -github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= @@ -1889,8 +1617,6 @@ github.com/xdrpp/goxdr v0.1.1/go.mod h1:dXo1scL/l6s7iME1gxHWo2XCppbHEKZS7m/KyYWk github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= github.com/xssnick/tonutils-go v1.14.1 h1:zV/iVYl/h3hArS+tPsd9XrSFfGert3r21caMltPSeHg= @@ -1903,8 +1629,6 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= -github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= @@ -1931,14 +1655,8 @@ go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I= go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.14 h1:vHObSCxyB9zlF60w7qzAdTcGaglbJOpSj1Xj9+WGxq0= -go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.14 h1:SaNH6Y+rVEdxfpA2Jr5wkEvN6Zykme5+YnbCkxvuWxQ= -go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v3 v3.5.14 h1:CWfRs4FDaDoSz81giL7zPpZH2Z35tbOrAJkkjMqOupg= -go.etcd.io/etcd/client/v3 v3.5.14/go.mod h1:k3XfdV/VIHy/97rqWjoUzrj9tk7GgJGH9J8L4dNXmAk= go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM= go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1951,65 +1669,15 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/collector/component v1.30.0 h1:HXjqBHaQ47/EEuWdnkjr4Y3kRWvmyWIDvqa1Q262Fls= -go.opentelemetry.io/collector/component v1.30.0/go.mod h1:vfM9kN+BM6oHBXWibquiprz8CVawxd4/aYy3nbhme3E= -go.opentelemetry.io/collector/component/componentstatus v0.124.0 h1:0WHaANNktxLIk+lN+CtgPBESI1MJBrfVW/LvNCbnMQ4= -go.opentelemetry.io/collector/component/componentstatus v0.124.0/go.mod h1:a/wa8nxJGWOGuLwCN8gHCzFHCaUVZ+VyUYuKz9Yaq38= -go.opentelemetry.io/collector/component/componenttest v0.124.0 h1:Wsc+DmDrWTFs/aEyjDA3slNwV+h/0NOyIR5Aywvr6Zw= -go.opentelemetry.io/collector/component/componenttest v0.124.0/go.mod h1:NQ4ATOzMFc7QA06B993tq8o27DR0cu/JR/zK7slGJ3E= -go.opentelemetry.io/collector/confmap v1.30.0 h1:Y0MXhjQCdMyJN9xZMWWdNPWs6ncMVf7YVnyAEN2dAcM= -go.opentelemetry.io/collector/confmap v1.30.0/go.mod h1:9DdThVDIC3VsdtTb7DgT+HwusWOocoqDkd/TErEtQgA= -go.opentelemetry.io/collector/confmap/xconfmap v0.124.0 h1:PK+CaSgjLvzHaafBieJ3AjiUTAPuf40C+/Fn38LvmW8= -go.opentelemetry.io/collector/confmap/xconfmap v0.124.0/go.mod h1:DZmFSgWiqXQrzld9uU+73YAVI5JRIgd8RkK5HcaXGU0= -go.opentelemetry.io/collector/consumer v1.30.0 h1:Nn6kFTH+EJbv13E0W+sNvWrTgbiFCRv8f6DaA2F1DQs= -go.opentelemetry.io/collector/consumer v1.30.0/go.mod h1:edRyfk61ugdhCQ93PBLRZfYMVWjdMPpKP8z5QLyESf0= -go.opentelemetry.io/collector/consumer/consumertest v0.124.0 h1:2arChG4RPrHW3lfVWlK/KDF7Y7qkUm/YAiBXh8oTue0= -go.opentelemetry.io/collector/consumer/consumertest v0.124.0/go.mod h1:Hlu+EXbINHxVAyIT1baKO2d0j5odR3fLlLAiaP+JqQg= -go.opentelemetry.io/collector/consumer/xconsumer v0.124.0 h1:/cut96EWVNoz6lIeGI9+EzS6UClMtnZkx5YIpkD0Xe0= -go.opentelemetry.io/collector/consumer/xconsumer v0.124.0/go.mod h1:fHH/MpzFCRNk/4foiYE6BoXQCAMf5sJTO35uvzVrrd4= -go.opentelemetry.io/collector/featuregate v1.30.0 h1:mx7+iP/FQnY7KO8qw/xE3Qd1MQkWcU8VgcqLNrJ8EU8= -go.opentelemetry.io/collector/featuregate v1.30.0/go.mod h1:Y/KsHbvREENKvvN9RlpiWk/IGBK+CATBYzIIpU7nccc= -go.opentelemetry.io/collector/internal/telemetry v0.124.0 h1:kzd1/ZYhLj4bt2pDB529mL4rIRrRacemXodFNxfhdWk= -go.opentelemetry.io/collector/internal/telemetry v0.124.0/go.mod h1:ZjXjqV0dJ+6D4XGhTOxg/WHjnhdmXsmwmUSgALea66Y= -go.opentelemetry.io/collector/pdata v1.35.0 h1:ck6WO6hCNjepADY/p9sT9/rLECTLO5ukYTumKzsqB/E= -go.opentelemetry.io/collector/pdata v1.35.0/go.mod h1:pttpb089864qG1k0DMeXLgwwTFLk+o3fAW9I6MF9tzw= -go.opentelemetry.io/collector/pdata/pprofile v0.124.0 h1:ZjL9wKqzP4BHj0/F1jfGxs1Va8B7xmYayipZeNVoWJE= -go.opentelemetry.io/collector/pdata/pprofile v0.124.0/go.mod h1:1EN3Gw5LSI4fSVma/Yfv/6nqeuYgRTm1/kmG5nE5Oyo= -go.opentelemetry.io/collector/pdata/testdata v0.124.0 h1:vY+pWG7CQfzzGSB5+zGYHQOltRQr59Ek9QiPe+rI+NY= -go.opentelemetry.io/collector/pdata/testdata v0.124.0/go.mod h1:lNH48lGhGv4CYk27fJecpsR1zYHmZjKgNrAprwjym0o= -go.opentelemetry.io/collector/pipeline v0.124.0 h1:hKvhDyH2GPnNO8LGL34ugf36sY7EOXPjBvlrvBhsOdw= -go.opentelemetry.io/collector/pipeline v0.124.0/go.mod h1:TO02zju/K6E+oFIOdi372Wk0MXd+Szy72zcTsFQwXl4= -go.opentelemetry.io/collector/processor v1.30.0 h1:dxmu+sO6MzQydyrf2CON5Hm1KU7yV4ofH1stmreUtPk= -go.opentelemetry.io/collector/processor v1.30.0/go.mod h1:DjXAgelT8rfIWCTJP5kiPpxPqz4JLE1mJwsE2kJMTk8= -go.opentelemetry.io/collector/processor/processortest v0.124.0 h1:qcyo0dSWmgpNFxjObsKk3Rd/wWV8CkMevd+jApkTQWE= -go.opentelemetry.io/collector/processor/processortest v0.124.0/go.mod h1:1YDTxd4c/uVU3Ui1+AzvYW94mo5DbhNmB1xSof6zvD0= -go.opentelemetry.io/collector/processor/xprocessor v0.124.0 h1:KAe8gIje8TcB8varZ4PDy0HV5xX5rNdaQ7q46BE915w= -go.opentelemetry.io/collector/processor/xprocessor v0.124.0/go.mod h1:ItJBBlR6/141vg1v4iRrcsBrGjPCgmXAztxS2x2YkdI= -go.opentelemetry.io/collector/semconv v0.124.0 h1:YTdo3UFwNyDQCh9DiSm2rbzAgBuwn/9dNZ0rv454goA= -go.opentelemetry.io/collector/semconv v0.124.0/go.mod h1:te6VQ4zZJO5Lp8dM2XIhDxDiL45mwX0YAQQWRQ0Qr9U= -go.opentelemetry.io/contrib/bridges/otelzap v0.10.0 h1:ojdSRDvjrnm30beHOmwsSvLpoRF40MlwNCA+Oo93kXU= -go.opentelemetry.io/contrib/bridges/otelzap v0.10.0/go.mod h1:oTTm4g7NEtHSV2i/0FeVdPaPgUIZPfQkFbq0vbzqnv0= -go.opentelemetry.io/contrib/bridges/prometheus v0.61.0 h1:RyrtJzu5MAmIcbRrwg75b+w3RlZCP0vJByDVzcpAe3M= -go.opentelemetry.io/contrib/bridges/prometheus v0.61.0/go.mod h1:tirr4p9NXbzjlbruiRGp53IzlYrDk5CO2fdHj0sSSaY= -go.opentelemetry.io/contrib/exporters/autoexport v0.61.0 h1:XfzKtKSrbtYk9TNCF8dkO0Y9M7IOfb4idCwBOTwGBiI= -go.opentelemetry.io/contrib/exporters/autoexport v0.61.0/go.mod h1:N6otC+qXTD5bAnbK2O1f/1SXq3cX+3KYSWrkBUqG0cw= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0 h1:1f31+6grJmV3X4lxcEvUy13i5/kfDw1nJZwhd8mA4tg= go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0/go.mod h1:1P/02zM3OwkX9uki+Wmxw3a5GVb6KUXRsa7m7bOC9Fg= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 h1:lREC4C0ilyP4WibDhQ7Gg2ygAQFP8oR07Fst/5cafwI= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0/go.mod h1:HfvuU0kW9HewH14VCOLImqKvUgONodURG7Alj/IrnGI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= -go.opentelemetry.io/contrib/propagators/jaeger v1.35.0 h1:UIrZgRBHUrYRlJ4V419lVb4rs2ar0wFzKNAebaP05XU= -go.opentelemetry.io/contrib/propagators/jaeger v1.35.0/go.mod h1:0ciyFyYZxE6JqRAQvIgGRabKWDUmNdW3GAQb6y/RlFU= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.30.0 h1:bQ1Gvah4Sp8z7epSkgJaNTuZm7sutfA6Fji2/7cKFMc= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.30.0/go.mod h1:9b8Q9rH52NgYH3ShiTFB5wf18Vt3RTH/VMB7LDcC1ug= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho= go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc= -go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4= -go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2 h1:06ZeJRe5BnYXceSM9Vya83XXVaNGe3H1QqsvqRANQq8= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.12.2/go.mod h1:DvPtKE63knkDVP88qpatBj81JxN+w1bqfVbsbCbj1WY= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.12.2 h1:tPLwQlXbJ8NSOfZc4OkgU5h2A38M4c9kfHSVc4PFQGs= @@ -2024,8 +1692,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0 h1:mq/Qc go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.41.0/go.mod h1:yk5LXEYhsL2htyDNJbEq7fWzNEigeEdV5xBF/Y+kAv0= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 h1:inYW9ZhgqiDqh6BioM7DVHHzEGVq76Db5897WLGZ5Go= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0/go.mod h1:Izur+Wt8gClgMJqO/cZ8wdeeMryJ/xxiOVgFSSfpDTY= -go.opentelemetry.io/otel/exporters/prometheus v0.58.0 h1:CJAxWKFIqdBennqxJyOgnt5LqkeFRT+Mz3Yjz3hL+h8= -go.opentelemetry.io/otel/exporters/prometheus v0.58.0/go.mod h1:7qo/4CLI+zYSNbv0GMNquzuss2FVZo3OYrGh96n4HNc= go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.13.0 h1:yEX3aC9KDgvYPhuKECHbOlr5GLwH6KTjLJ1sBSkkxkc= go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.13.0/go.mod h1:/GXR0tBmmkxDaCUGahvksvp66mx4yh5+cFXgSlhg0vQ= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.36.0 h1:rixTyDGXFxRy1xzhKrotaHy3/KXdPhlWARrCgK+eqUY= @@ -2034,8 +1700,6 @@ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.36.0 h1:G8Xec/SgZQricwW go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.36.0/go.mod h1:PD57idA/AiFD5aqoxGxCvT/ILJPeHy3MjqU/NS7KogY= go.opentelemetry.io/otel/log v0.15.0 h1:0VqVnc3MgyYd7QqNVIldC3dsLFKgazR6P3P3+ypkyDY= go.opentelemetry.io/otel/log v0.15.0/go.mod h1:9c/G1zbyZfgu1HmQD7Qj84QMmwTp2QCQsZH1aeoWDE4= -go.opentelemetry.io/otel/log/logtest v0.0.0-20250616193322-2cce18995527 h1:K4gsUDjRKwV+Uw9lSEM7NdFqIfTfDlwv6zoGgffbtwk= -go.opentelemetry.io/otel/log/logtest v0.0.0-20250616193322-2cce18995527/go.mod h1:DqYX8Lp2A/RnuxXuoVtsRqYvx6Io0PtSxF5v9MnHJyU= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4= go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI= @@ -2090,8 +1754,6 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -go4.org/netipx v0.0.0-20230125063823-8449b0a6169f h1:ketMxHg+vWm3yccyYiq+uK8D3fRmna2Fcj+awpQp84s= -go4.org/netipx v0.0.0-20230125063823-8449b0a6169f/go.mod h1:tgPU4N2u9RByaTN3NC2p9xOzyFpte4jYwsIIRF7XlSc= golang.org/x/arch v0.11.0 h1:KXV8WWKCXm6tRpLirl2szsO5j/oOODwZf4hATmGVNs4= golang.org/x/arch v0.11.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -2262,7 +1924,6 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2330,7 +1991,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2495,8 +2155,6 @@ google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjR google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/api v0.241.0 h1:QKwqWQlkc6O895LchPEDUSYr22Xp3NCxpQRiWTB6avE= -google.golang.org/api v0.241.0/go.mod h1:cOVEm2TpdAGHL2z+UwyS+kmlGr3bVWQQ6sYEqkKje50= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2505,7 +2163,6 @@ google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -2556,7 +2213,6 @@ google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1: google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY= google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 h1:mWPCjDEyshlQYzBpMNHaEof6UX1PmHcaUODUywQ0uac= google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -2613,8 +2269,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 58e172d9b07..4076046c4a1 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -110,7 +110,6 @@ require ( github.com/aws/smithy-go v1.24.2 // indirect github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect - github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect github.com/beevik/ntp v1.5.0 // indirect github.com/benbjohnson/clock v1.3.5 // indirect @@ -267,7 +266,6 @@ require ( github.com/google/go-github/v72 v72.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-tpm v0.9.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect github.com/google/s2a-go v0.1.9 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect @@ -545,8 +543,6 @@ require ( github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/ugorji/go/codec v1.2.12 // indirect - github.com/umbracle/ethgo v0.1.3 // indirect - github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect github.com/urfave/cli/v2 v2.27.7 // indirect github.com/valyala/fastjson v1.6.10 // indirect github.com/vektah/gqlparser/v2 v2.5.19 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index bf2007188ce..5ed27f0243b 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -135,8 +135,6 @@ github.com/NethermindEth/juno v0.12.5 h1:a+KYQg8MxzNJIbbqGHq+vU9nTyuWu3acbyXxcUP github.com/NethermindEth/juno v0.12.5/go.mod h1:XonWmZVRwCVHv1gjoVCoTFiZnYObwdukpd3NCsl04bA= github.com/NethermindEth/starknet.go v0.8.0 h1:mGh7qDWrvuXJPcgGJP31DpifzP6+Ef2gt/BQhaqsV40= github.com/NethermindEth/starknet.go v0.8.0/go.mod h1:slNA8PxtxA/0LQv0FwHnL3lHFDNhVZfTK6U2gjVb7l8= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 h1:1zYrtlhrZ6/b6SAjLSfKzWtdgqK0U+HtH/VcBWh1BaU= github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI= @@ -388,8 +386,6 @@ github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 h1:icCHutJouWlQREayFwCc7lxD github.com/confluentinc/confluent-kafka-go/v2 v2.3.0/go.mod h1:/VTy8iEpe6mD9pkCH5BhijlUl8ulUXymKv1Qig5Rgb8= github.com/consensys/gnark-crypto v0.19.2 h1:qrEAIXq3T4egxqiliFFoNrepkIWVEeIYwt3UL0fvS80= github.com/consensys/gnark-crypto v0.19.2/go.mod h1:rT23F0XSZqE0mUA0+pRtnL56IbPxs6gp4CeRsBk4XS0= -github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= -github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= @@ -1361,8 +1357,6 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opentracing-contrib/go-grpc v0.1.2 h1:MP16Ozc59kqqwn1v18aQxpeGZhsBanJ2iurZYaQSZ+g= github.com/opentracing-contrib/go-grpc v0.1.2/go.mod h1:glU6rl1Fhfp9aXUHkE36K2mR4ht8vih0ekOVlWKEUHM= github.com/opentracing-contrib/go-stdlib v1.1.0 h1:cZBWc4pA4e65tqTJddbflK435S0tDImj6c9BMvkdUH0= @@ -1370,8 +1364,6 @@ github.com/opentracing-contrib/go-stdlib v1.1.0/go.mod h1:S0p+X9p6dcBkoMTL+Qq2VO github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A= github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b/go.mod h1:AC62GU6hc0BrNm+9RK9VSiwa/EUe1bkIeFORAMcHvJU= -github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/otiai10/copy v1.14.1 h1:5/7E6qsUMBaH5AnQ0sSLzzTg1oTECmcCmT6lvF45Na8= github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I= github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs= diff --git a/integration-tests/main.go b/integration-tests/main.go deleted file mode 100644 index 2a6f00042b0..00000000000 --- a/integration-tests/main.go +++ /dev/null @@ -1,99 +0,0 @@ -package main - -import ( - "fmt" - - gh "github.com/cli/go-gh/v2" -) - -const ( - art string = ` -------------------------------------------------------------------------------------------------- - _____ _ _ _ _ _ _____ _ ______ -/ __ \ | (_) | (_) | | |_ _| | | | ___ \ -| / \/ |__ __ _ _ _ __ | |_ _ __ | | __ | | ___ ___| |_ | |_/ / _ _ __ _ __ ___ _ __ -| | | '_ \ / _, | | '_ \| | | '_ \| |/ / | |/ _ \/ __| __| | / | | | '_ \| '_ \ / _ \ '__| -| \__/\ | | | (_| | | | | | | | | | | < | | __/\__ \ |_ | |\ \ |_| | | | | | | | __/ | - \____/_| |_|\__,_|_|_| |_|_|_|_| |_|_|\_\ \_/\___||___/\__| \_| \_\__,_|_| |_|_| |_|\___|_| -------------------------------------------------------------------------------------------------- - -Make sure you have the GitHub CLI and it's authorized. Find it at https://cli.github.com/ - -Follow the prompts to run an E2E test. Type to search, use arrow keys to scroll, and Enter to select an option. -` - helpText string = "What do these mean?" - chainlinkRepo string = "smartcontractkit/chainlink" - workflowFile string = "generic-test-runner.yml" -) - -var ( - testDirectories = []string{helpText, "smoke", "soak", "performance", "reorg", "chaos", "benchmark"} -) - -func main() { - // This can take a while to retrieve, start it at the beginning asynchronously - branchesAndTags, branchesAndTagsErr := make(chan []string, 1), make(chan error, 1) - go collectBranchesAndTags(branchesAndTags, branchesAndTagsErr) - - fmt.Print(art) - - ghUser, err := getUser() - if err != nil { - fmt.Printf("error getting GitHub user, make sure you're signed in to the GitHub CLI: %v\n", err) - return - } - fmt.Printf("Running as %s\n", ghUser) - - network, wsURL, httpURL, fundingKey, err := getNetwork() - if err != nil { - fmt.Printf("error getting network: %v\n", err) - return - } - - dir, err := getTestDirectory() - if err != nil { - fmt.Printf("error getting test directory: %v\n", err) - return - } - - err = <-branchesAndTagsErr - if err != nil { - fmt.Printf("error getting branches and tags: %v\n", err) - return - } - branch, err := getTestBranch(<-branchesAndTags) - if err != nil { - fmt.Printf("error selecting test branch: %v\n", err) - return - } - - test, err := getTest(dir) - if err != nil { - fmt.Printf("error getting test: %v\n", err) - return - } - - stdOut, stdErr, err := gh.Exec( // Triggers the workflow with specified test - "workflow", "run", workflowFile, - "--repo", chainlinkRepo, - "--ref", branch, - "-f", "directory="+dir, - "-f", "test=Test"+test, - "-f", "network="+network, - "-f", "wsURL="+wsURL, - "-f", "httpURL="+httpURL, - "-f", "fundingKey="+fundingKey, - ) - if err != nil { - fmt.Printf("Error running gh workflow run: %v\n", err) - fmt.Println(stdErr.String()) - return - } - fmt.Println(stdOut.String()) - - _, err = waitForWorkflowRun(branch, ghUser) - if err != nil { - fmt.Printf("Error waiting for workflow to start: %v\n", err) - return - } -} diff --git a/integration-tests/runner_helpers.go b/integration-tests/runner_helpers.go deleted file mode 100644 index 52feab622c4..00000000000 --- a/integration-tests/runner_helpers.go +++ /dev/null @@ -1,358 +0,0 @@ -package main - -import ( - "bufio" - "encoding/json" - "errors" - "fmt" - "os" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" - "time" - - "github.com/cli/go-gh/v2" - "github.com/ethereum/go-ethereum/crypto" - "github.com/manifoldco/promptui" - "github.com/rs/zerolog/log" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" -) - -func waitForWorkflowRun(branch, ghUser string) (string, error) { - fmt.Println("Waiting for workflow to start") - startTime := time.Now() - checkWorkflow, timeout := time.NewTicker(time.Second), time.After(time.Second*15) - defer checkWorkflow.Stop() - for { - select { - case <-checkWorkflow.C: - workflowId, err := checkWorkflowRun(startTime, branch, ghUser) - if err != nil { - return "", err - } - if workflowId == "" { - fmt.Println("Checking...") - continue - } - fmt.Printf("Triggered Workflow with ID: %s\n", workflowId) - fmt.Println("Opening run in browser...") - _, stdErr, err := gh.Exec( // Opens the run in browser - "run", "view", workflowId, "-w", - ) - if err != nil { - fmt.Println(stdErr.String()) - return "", err - } - return workflowId, nil - case <-timeout: - return "", errors.New("timed out waiting for workflow run to start") - } - } -} - -func checkWorkflowRun(startTime time.Time, branch, ghUser string) (string, error) { - stdOut, stdErr, err := gh.Exec( // Retrieves the runId of the workflow we just started - "run", "list", "-b", branch, "-w", workflowFile, "-u", ghUser, - "--json", "startedAt,databaseId", "-q", ".[0]", - ) - if err != nil { - fmt.Println(stdErr.String()) - return "", err - } - if stdOut.String() == "" { - return "", nil - } - workflowRun := struct { - DatabaseId int `json:"databaseId"` - StartedAt time.Time `json:"startedAt"` - }{} - err = json.Unmarshal(stdOut.Bytes(), &workflowRun) - if err != nil { - return "", err - } - if workflowRun.StartedAt.Before(startTime) { // Make sure the workflow run started after we started waiting - return "", nil - } - return strconv.Itoa(workflowRun.DatabaseId), nil -} - -// getUser retrieves the current GitHub user's username -func getUser() (string, error) { - stdOut, stdErr, err := gh.Exec( - "api", "user", "-q", ".login", - ) - if err != nil { - fmt.Println(stdErr.String()) - return "", err - } - return stdOut.String(), nil -} - -// getTestBranch prompts the user to select a test branch -func getTestBranch(options []string) (string, error) { - fmt.Println("Ensure your branch has had its latest work pushed to GitHub before running a test.") - testBranchPrompt := promptui.Select{ - Label: "Test Branch or Tag", - Items: options, - Searcher: func(input string, index int) bool { - return strings.Contains(options[index], input) - }, - StartInSearchMode: true, - } - _, branch, err := testBranchPrompt.Run() - if err != nil { - return "", err - } - return branch, nil -} - -// getAllBranchesAndTags uses the github API to retrieve all branches and tags for the chainlink repo -// this call can take a while, so start it at the beginning asynchronously -func collectBranchesAndTags(results chan []string, errChan chan error) { - defer close(errChan) - defer close(results) - - branchChan, tagChan := make(chan []string, 1), make(chan []string, 1) - defer close(branchChan) - defer close(tagChan) - - // branches - go func() { - stdOut, stdErr, err := gh.Exec("api", fmt.Sprintf("repos/%s/branches", chainlinkRepo), "-q", ".[][\"name\"]", "--paginate") - if err != nil { - errChan <- fmt.Errorf("%w: %s", err, stdErr.String()) - } - branches := strings.Split(stdOut.String(), "\n") - cleanBranches := []string{} - for _, branch := range branches { - trimmed := strings.TrimSpace(branch) - if branch != "" { - cleanBranches = append(cleanBranches, trimmed) - } - } - branchChan <- cleanBranches - }() - - // tags - go func() { - stdOut, stdErr, err := gh.Exec("api", fmt.Sprintf("repos/%s/tags", chainlinkRepo), "-q", ".[][\"name\"]", "--paginate") - if err != nil { - errChan <- fmt.Errorf("%w: %s", err, stdErr.String()) - } - tags := strings.Split(stdOut.String(), "\n") - cleanTags := []string{} - for _, tag := range tags { - trimmed := strings.TrimSpace(tag) - if tag != "" { - cleanTags = append(cleanTags, trimmed) - } - } - tagChan <- cleanTags - }() - - // combine results - branches, tags := <-branchChan, <-tagChan - combined := append(branches, tags...) - sort.Slice(combined, func(i, j int) bool { - if combined[i] == "develop" { - return true - } else if combined[j] == "develop" { - return false - } - return strings.Compare(combined[i], combined[j]) < 0 - }) - results <- combined -} - -const helpDirectoryText = `Smoke tests are designed to be quick checks on basic functionality. - -Soak tests are designed to run for a long time and test the stability of the system under minimal or regular load. - -Performance tests are designed to test the system under heavy load and measure performance metrics. - -Chaos tests are designed to break the system in various ways and ensure it recovers gracefully. - -Reorg tests are designed to test the system's ability to handle reorgs on the blockchain. - -Benchmark tests are designed to check how far the system can go before running into issues.` - -// getTestDirectory prompts the user to select a test directory -func getTestDirectory() (string, error) { - testDirectoryPrompt := promptui.Select{ - Label: "Test Type", - Items: testDirectories, - Size: 10, - Searcher: func(input string, index int) bool { - return strings.Contains(testDirectories[index], input) - }, - StartInSearchMode: true, - } - _, dir, err := testDirectoryPrompt.Run() - if err != nil { - return "", err - } - if dir == helpText { - fmt.Println(helpDirectoryText) - return getTestDirectory() - } - return dir, nil -} - -// getTest searches the chosen test directory for valid tests to run -func getTest(dir string) (string, error) { - items := testNames(dir) - testPrompt := promptui.Select{ - Label: "Test Name", - Items: items, - Size: 15, - Searcher: func(input string, index int) bool { - return strings.Contains(strings.ToLower(items[index]), strings.ToLower(input)) - }, - StartInSearchMode: true, - } - _, test, err := testPrompt.Run() - if err != nil { - return "", err - } - return test, nil -} - -// testNames returns a list of test names in the given directory -func testNames(directory string) []string { - // Regular expression pattern to search for - pattern := "func Test(\\w+?)\\(t \\*testing.T\\)" - - names := []string{} - - err := filepath.Walk(directory, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if info.IsDir() { // Skip directories - return nil - } - if !strings.HasSuffix(info.Name(), "_test.go") { // Skip non-test files - return nil - } - - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - scanner := bufio.NewScanner(file) - regex := regexp.MustCompile(pattern) - // Iterate over each line in the file - for scanner.Scan() { - line := scanner.Text() - submatches := regex.FindStringSubmatch(line) - if len(submatches) > 0 { - names = append(names, submatches[1]) - } - } - - if scanner.Err() != nil { - log.Error().Str("File", info.Name()).Msg("Error scanning file") - } - return scanner.Err() - }) - - if err != nil { - log.Fatal().Err(err).Msg("Error looking for tests") - } - sort.Strings(names) - return names -} - -// getNetwork prompts the user for a network to run the test on, including urls and keys if necessary -func getNetwork() (networkName, networkWs, networkHTTP, fundingKey string, err error) { - validNetworks, i := make([]string, len(networks.MappedNetworks)), 0 - for network := range networks.MappedNetworks { - validNetworks[i] = network - i++ - } - sort.Slice(validNetworks, func(i, j int) bool { // Get in (mostly) alphabetical order - if validNetworks[i] == "SIMULATED" { - return true - } else if validNetworks[j] == "SIMULATED" { - return false - } - return strings.Compare(validNetworks[i], validNetworks[j]) < 0 - }) - - networkPrompt := promptui.Select{ - Label: "Network", - Items: validNetworks, - Size: 10, - Searcher: func(input string, index int) bool { - return strings.Contains(strings.ToLower(validNetworks[index]), strings.ToLower(input)) - }, - StartInSearchMode: true, - } - _, network, err := networkPrompt.Run() - if err != nil { - return "", "", "", "", err - } - if strings.Contains(network, "SIMULATED") { // We take care of simulated network URLs - return network, "", "", "", nil - } - - networkWsPrompt := promptui.Prompt{ - Label: "Network WS URL", - Validate: func(s string) error { - if s == "" { - return errors.New("URL cannot be empty") - } - if !strings.HasPrefix(s, "ws") { - return errors.New("URL must start with ws") - } - return nil - }, - } - networkWs, err = networkWsPrompt.Run() - if err != nil { - return "", "", "", "", err - } - - networkHTTPPrompt := promptui.Prompt{ - Label: "Network HTTP URL", - Validate: func(s string) error { - if s == "" { - return errors.New("URL cannot be empty") - } - if !strings.HasPrefix(s, "http") { - return errors.New("URL must start with http") - } - return nil - }, - } - networkHTTP, err = networkHTTPPrompt.Run() - if err != nil { - return "", "", "", "", err - } - - networkFundingKeyPrompt := promptui.Prompt{ - Label: "Network Funding Key", - Validate: func(s string) error { - if s == "" { - return errors.New("funding key cannot be empty for a non-simulated network") - } - _, err := crypto.HexToECDSA(s) - if err != nil { - return fmt.Errorf("funding key must be a valid hex string: %w", err) - } - return nil - }, - } - fundingKey, err = networkFundingKeyPrompt.Run() - if err != nil { - return "", "", "", "", err - } - - return network, networkWs, networkHTTP, fundingKey, nil -} diff --git a/integration-tests/scripts/show_coverage.go b/integration-tests/scripts/show_coverage.go deleted file mode 100644 index 0491ec744a2..00000000000 --- a/integration-tests/scripts/show_coverage.go +++ /dev/null @@ -1,78 +0,0 @@ -package main - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" -) - -// main manages the process of combining coverage data for all tests -func main() { - // Check if the user has provided an argument - if len(os.Args) < 2 { - fmt.Println("Usage: go run script.go ") - os.Exit(1) - } - - // First argument after the program name is the search pattern - searchPattern := os.Args[1] - - // Glob pattern to find all 'merged' directories in artifact folders - dirs, err := filepath.Glob(searchPattern) - if err != nil { - fmt.Printf("Failed to find directories: %v\n", err) - os.Exit(1) - } - - if len(dirs) == 0 { - fmt.Println("No directories found.") - return - } - - fmt.Printf("Found directories with test coverage data: %v\n", dirs) - - // Join the directory paths for input - dirInput := strings.Join(dirs, ",") - - // Ensure the merged directory exists - mergedDir := filepath.Join(".covdata", "merged") - if err := os.MkdirAll(mergedDir, 0755); err != nil { - fmt.Printf("Failed to create merged directory %s: %v\n", mergedDir, err) - os.Exit(1) - } - - // Merge the coverage data from all chainlink nodes - mergeCmd := exec.Command("go", "tool", "covdata", "merge", "-o", mergedDir, "-i="+dirInput) - fmt.Printf("Merging coverage data for all tests:\n%s\n", mergeCmd.String()) - output, err := mergeCmd.CombinedOutput() - if err != nil { - fmt.Printf("Error executing merge command: %v, output: %s\n", err, output) - os.Exit(1) - } - - // Calculate coverage percentage in the merged directory - coverageCmd := exec.Command("go", "tool", "covdata", "percent", "-i=.") - coverageCmd.Dir = mergedDir - fmt.Printf("Calculate total coverage for on all tests: %s\n", coverageCmd.String()) - coverageOutput, err := coverageCmd.CombinedOutput() - if err != nil { - fmt.Printf("Error calculating coverage percentage: %v\n", err) - os.Exit(1) - } - - // Save the coverage percentage to a file - filePath, err := filepath.Abs(filepath.Join(mergedDir, "percentage.txt")) - if err != nil { - fmt.Printf("Error obtaining absolute path: %s\n", err) - os.Exit(1) - } - if err := os.WriteFile(filePath, coverageOutput, 0600); err != nil { - fmt.Printf("Failed to write coverage percentage to file: %v\n", err) - os.Exit(1) - } - fmt.Printf("Total coverage for all tests saved to %s\n", filePath) - - fmt.Printf("Total coverage for all tests:\n%s\n", string(coverageOutput)) -} diff --git a/integration-tests/testconfig/automation/automation.toml b/integration-tests/testconfig/automation/automation.toml deleted file mode 100644 index b2e87fa34f9..00000000000 --- a/integration-tests/testconfig/automation/automation.toml +++ /dev/null @@ -1,552 +0,0 @@ -# product defaults -[Common] -chainlink_node_funding = 2.0 - -[Pyroscope] -enabled=false - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -""" - -# smoke test specific overrodes -[Smoke.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Smoke.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=30_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Smoke.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=3_600_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Smoke.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Smoke.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=200_000_000 -flat_fee_micro_link=0 -check_gas_limit=2_500_000 -staleness_seconds=90000 -gas_ceiling_multiplier=1 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 - -# reorg test specific overrides -[Reorg.Common] -chainlink_node_funding = 2.0 - - -[Reorg.Automation] - -[Reorg.NodeConfig.ChainConfigTOMLByChainID] -# applicable for simulated chain -1337 = """ -AutoCreateKey = true -FinalityDepth = 20 -LogPollInterval = '1s' -MinContractPayment = 0 -[HeadTracker] -HistoryDepth = 30 -[GasEstimator] -Mode = 'FixedPrice' -LimitDefault = 5_000_000 -""" - -[Reorg.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Reorg.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=30_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Reorg.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=3_600_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Reorg.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Reorg.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=200_000_000 -flat_fee_micro_link=0 -check_gas_limit=2_500_000 -staleness_seconds=90000 -gas_ceiling_multiplier=1 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 - -# chaos test specific overrides -[Chaos.Common] -chainlink_node_funding = 2.0 - -[Chaos.Automation] - -[Chaos.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Chaos.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=30_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Chaos.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=3_600_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Chaos.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Chaos.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=200_000_000 -flat_fee_micro_link=0 -check_gas_limit=2_500_000 -staleness_seconds=90000 -gas_ceiling_multiplier=1 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 - -# load test specific overrides -[Load.Logging.Grafana] -base_url="https://grafana.ops.prod.cldev.sh" -dashboard_url="/d/a4899f53-f709-430a-aec2-24f32198dcc9/chainlink-automation-v2-load-test" - -[Load.Seth] -ephemeral_addresses_number = 100 -root_key_funds_buffer = 1_000_000 - -[Load.Common] -chainlink_node_funding = 1000 - -[Load.Automation] -[Load.Automation.General] -number_of_nodes=6 -duration=900 -block_time=1 -spec_type="minimum" -chainlink_node_log_level="info" -use_prometheus=false -remove_namespace = true - -[Load.Automation.DataStreams] -enabled=false - -[[Load.Automation.Load]] -number_of_upkeeps=5 -number_of_events = 1 -number_of_spam_matching_events = 1 -number_of_spam_non_matching_events = 0 -check_burn_amount = 0 -perform_burn_amount = 0 -upkeep_gas_limit = 1000000 -shared_trigger = false -is_streams_lookup = false -feeds = ["0x000200"] - -[[Load.Automation.Load]] -number_of_upkeeps=5 -number_of_events = 1 -number_of_spam_matching_events = 0 -number_of_spam_non_matching_events = 1 -check_burn_amount = 0 -perform_burn_amount = 0 -upkeep_gas_limit = 1000000 -shared_trigger = true -is_streams_lookup = false -feeds = ["0x000200"] - -[Load.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Load.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=15_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Load.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=80_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Load.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Load.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=0 -flat_fee_micro_link=40000 -check_gas_limit=45_000_000 -staleness_seconds=90_000 -gas_ceiling_multiplier=2 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 - -[Load.Pyroscope] -enabled=false - -# automation benchmark test specific overrides -[Benchmark.Logging.Grafana] -base_url="https://grafana.ops.prod.cldev.sh" -dashboard_url="/d/Q8n6m1unz/chainlink-automation-benchmark-test" - -# will retry roughly for 1h before giving up (900 * 4s) -[Benchmark.Automation.Resiliency] -# number of retries before giving up -contract_call_limit = 900 -# static interval between retries -contract_call_interval = "4s" - -[Benchmark.Seth] -# keeper benchmark running on simulated network requires 100k per node -root_key_funds_buffer = 1_000_000 - -[Benchmark.Automation] -[Benchmark.Automation.General] -number_of_nodes=6 -duration=3600 -block_time=1 -spec_type="minimum" -chainlink_node_log_level="info" -use_prometheus=false -remove_namespace = true - -[Benchmark.Automation.Benchmark] -registry_to_test = "2_1" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 1000 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 3600 -block_interval = 60 -forces_single_tx_key = false -delete_jobs_on_end = true - -[Benchmark.NodeConfig] -BaseConfigTOML = """ -[Feature] -LogPoller = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -Enabled = true -AnnounceAddresses = ["0.0.0.0:6690"] -ListenAddresses = ["0.0.0.0:6690"] -[Keeper] -TurnLookBack = 0 -[WebServer] -HTTPWriteTimeout = '1h' -""" - -CommonChainConfigTOML = """ -""" - -[Benchmark.NodeConfig.ChainConfigTOMLByChainID] -# applicable for simulated chain -1337 = """ -FinalityDepth = 50 -LogPollInterval = '1s' -MinIncomingConfirmations = 1 - -[HeadTracker] -HistoryDepth = 100 - -[GasEstimator] -Mode = 'FixedPrice' -LimitDefault = 5_000_000 -""" - -[Benchmark.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Benchmark.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=30_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Benchmark.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=3_600_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Benchmark.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Benchmark.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=0 -flat_fee_micro_link=40000 -check_gas_limit=45_000_000 -staleness_seconds=90_000 -gas_ceiling_multiplier=2 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 - -# automation soak test specific overrides -[Soak.Logging.Grafana] -base_url="https://grafana.ops.prod.cldev.sh" -dashboard_url="/d/Q8n6m1unz/chainlink-automation-benchmark-test" - -# will retry roughly for 1h before giving up (900 * 4s) -[Soak.Automation.Resiliency] -# number of retries before giving up -contract_call_limit = 900 -# static interval between retries -contract_call_interval = "4s" - -[Soak.Seth] -# keeper benchmark running on simulated network requires 100k per node -root_key_funds_buffer = 1_000_000 - -[Soak.Automation] -[Soak.Automation.General] -number_of_nodes=6 -duration=3600 -block_time=1 -spec_type="minimum" -chainlink_node_log_level="info" -use_prometheus=false -remove_namespace = true - -[Soak.Automation.Benchmark] -registry_to_test = "2_1" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 50 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 28800 -block_interval = 300 -forces_single_tx_key = false -delete_jobs_on_end = true - -[Soak.NodeConfig] -BaseConfigTOML = """ -[Feature] -LogPoller = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -Enabled = true -AnnounceAddresses = ["0.0.0.0:6690"] -ListenAddresses = ["0.0.0.0:6690"] -[Keeper] -TurnLookBack = 0 -[WebServer] -HTTPWriteTimeout = '1h' -""" - -CommonChainConfigTOML = """ -""" - -[Soak.NodeConfig.ChainConfigTOMLByChainID] -# applicable for simulated chain -1337 = """ -FinalityDepth = 50 -LogPollInterval = '1s' -MinIncomingConfirmations = 1 - -[HeadTracker] -HistoryDepth = 100 - -[GasEstimator] -Mode = 'FixedPrice' -LimitDefault = 5_000_000 -""" - -[Soak.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Soak.Automation.AutomationConfig.PublicConfig] -delta_progress=10_000_000_000 -delta_resend=15_000_000_000 -delta_initial=500_000_000 -delta_round=1_000_000_000 -delta_grace=200_000_000 -delta_certified_commit_request=300_000_000 -delta_stage=30_000_000_000 -r_max=24 -f=1 -max_duration_query=20_000_000 -max_duration_observation=20_000_000 -max_duration_should_accept_attested_report=1_200_000_000 -max_duration_should_transmit_accepted_report=20_000_000 - -[Soak.Automation.AutomationConfig.PluginConfig] -perform_lockout_window=3_600_000 -target_probability="0.999" -target_in_rounds=1 -min_confirmations=0 -gas_limit_per_report=10_300_000 -gas_overhead_per_upkeep=300_000 -max_upkeep_batch_size=10 - -[Soak.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Soak.Automation.AutomationConfig.RegistrySettings] -payment_premium_ppb=200_000_000 -flat_fee_micro_link=0 -check_gas_limit=2_500_000 -staleness_seconds=90000 -gas_ceiling_multiplier=1 -max_perform_gas=5_000_000 -min_upkeep_spend=0 -fallback_gas_price=200_000_000_000 -fallback_link_price=2_000_000_000_000_000_000 -fallback_native_price=2_000_000_000_000_000_000 -max_check_data_size=5_000 -max_perform_data_size=5_000 -max_revert_data_size=5_000 diff --git a/integration-tests/testconfig/automation/config.go b/integration-tests/testconfig/automation/config.go deleted file mode 100644 index 853e06798a0..00000000000 --- a/integration-tests/testconfig/automation/config.go +++ /dev/null @@ -1,846 +0,0 @@ -package automation - -import ( - "errors" - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" -) - -type Config struct { - General *General `toml:"General"` - Load []Load `toml:"Load"` - DataStreams *DataStreams `toml:"DataStreams"` - AutomationConfig *AutomationConfig `toml:"AutomationConfig"` - Resiliency *ResiliencyConfig `toml:"Resiliency"` - Benchmark *Benchmark `toml:"Benchmark"` - Contracts *Contracts `toml:"Contracts"` -} - -func (c *Config) Validate() error { - if c.General != nil { - if err := c.General.Validate(); err != nil { - return err - } - } - if len(c.Load) > 0 { - for _, load := range c.Load { - if err := load.Validate(); err != nil { - return err - } - } - } - if c.DataStreams != nil { - if err := c.DataStreams.Validate(); err != nil { - return err - } - } - - if c.AutomationConfig != nil { - if err := c.AutomationConfig.Validate(); err != nil { - return err - } - } - if c.Resiliency != nil { - if err := c.Resiliency.Validate(); err != nil { - return err - } - } - if c.Benchmark != nil { - if err := c.Benchmark.Validate(); err != nil { - return err - } - } - return nil -} - -type Benchmark struct { - RegistryToTest *string `toml:"registry_to_test"` - NumberOfRegistries *int `toml:"number_of_registries"` - NumberOfUpkeeps *int `toml:"number_of_upkeeps"` - UpkeepGasLimit *int64 `toml:"upkeep_gas_limit"` - CheckGasToBurn *int64 `toml:"check_gas_to_burn"` - PerformGasToBurn *int64 `toml:"perform_gas_to_burn"` - BlockRange *int64 `toml:"block_range"` - BlockInterval *int64 `toml:"block_interval"` - ForceSingleTxKey *bool `toml:"forces_single_tx_key"` - DeleteJobsOnEnd *bool `toml:"delete_jobs_on_end"` -} - -func (c *Benchmark) Validate() error { - if c.RegistryToTest == nil || *c.RegistryToTest == "" { - return errors.New("registry_to_test must be set") - } - if c.NumberOfRegistries == nil || *c.NumberOfRegistries <= 0 { - return errors.New("number_of_registries must be a positive integer") - } - if c.NumberOfUpkeeps == nil || *c.NumberOfUpkeeps <= 0 { - return errors.New("number_of_upkeeps must be a positive integer") - } - if c.UpkeepGasLimit == nil || *c.UpkeepGasLimit <= 0 { - return errors.New("upkeep_gas_limit must be a positive integer") - } - if c.CheckGasToBurn == nil || *c.CheckGasToBurn <= 0 { - return errors.New("check_gas_to_burn must be a positive integer") - } - if c.PerformGasToBurn == nil || *c.PerformGasToBurn <= 0 { - return errors.New("perform_gas_to_burn must be a positive integer") - } - if c.BlockRange == nil || *c.BlockRange <= 0 { - return errors.New("block_range must be a positive integer") - } - if c.BlockInterval == nil || *c.BlockInterval <= 0 { - return errors.New("block_interval must be a positive integer") - } - return nil -} - -// General is a common configuration for all automation performance tests -type General struct { - NumberOfNodes *int `toml:"number_of_nodes"` - Duration *int `toml:"duration"` - BlockTime *int `toml:"block_time"` - SpecType *string `toml:"spec_type"` - ChainlinkNodeLogLevel *string `toml:"chainlink_node_log_level"` - UsePrometheus *bool `toml:"use_prometheus"` - RemoveNamespace *bool `toml:"remove_namespace"` -} - -func (c *General) Validate() error { - if c.NumberOfNodes == nil || *c.NumberOfNodes < 1 { - return errors.New("number_of_nodes must be set to a positive integer") - } - if c.Duration == nil || *c.Duration < 1 { - return errors.New("duration must be set to a positive integer") - } - if c.BlockTime == nil || *c.BlockTime < 1 { - return errors.New("block_time must be set to a positive integer") - } - if c.SpecType == nil { - return errors.New("spec_type must be set") - } - if c.ChainlinkNodeLogLevel == nil { - return errors.New("chainlink_node_log_level must be set") - } - if c.UsePrometheus == nil { - return errors.New("use_prometheus must be set") - } - if c.RemoveNamespace == nil { - return errors.New("remove_namespace must be set") - } - - return nil -} - -type Load struct { - NumberOfUpkeeps *int `toml:"number_of_upkeeps"` - NumberOfEvents *int `toml:"number_of_events"` - NumberOfSpamMatchingEvents *int `toml:"number_of_spam_matching_events"` - NumberOfSpamNonMatchingEvents *int `toml:"number_of_spam_non_matching_events"` - CheckBurnAmount *big.Int `toml:"check_burn_amount"` - PerformBurnAmount *big.Int `toml:"perform_burn_amount"` - SharedTrigger *bool `toml:"shared_trigger"` - UpkeepGasLimit *uint32 `toml:"upkeep_gas_limit"` - IsStreamsLookup *bool `toml:"is_streams_lookup"` - Feeds []string `toml:"feeds"` -} - -func (c *Load) Validate() error { - if c.NumberOfUpkeeps == nil || *c.NumberOfUpkeeps < 1 { - return errors.New("number_of_upkeeps must be set to a positive integer") - } - if c.NumberOfEvents == nil || *c.NumberOfEvents < 0 { - return errors.New("number_of_events must be set to a non-negative integer") - } - if c.NumberOfSpamMatchingEvents == nil || *c.NumberOfSpamMatchingEvents < 0 { - return errors.New("number_of_spam_matching_events must be set to a non-negative integer") - } - if c.NumberOfSpamNonMatchingEvents == nil || *c.NumberOfSpamNonMatchingEvents < 0 { - return errors.New("number_of_spam_non_matching_events must be set to a non-negative integer") - } - if c.CheckBurnAmount == nil || c.CheckBurnAmount.Cmp(big.NewInt(0)) < 0 { - return errors.New("check_burn_amount must be set to a non-negative integer") - } - if c.PerformBurnAmount == nil || c.PerformBurnAmount.Cmp(big.NewInt(0)) < 0 { - return errors.New("perform_burn_amount must be set to a non-negative integer") - } - if c.SharedTrigger == nil { - return errors.New("shared_trigger must be set") - } - if c.UpkeepGasLimit == nil || *c.UpkeepGasLimit < 1 { - return errors.New("upkeep_gas_limit must be set to a positive integer") - } - if c.IsStreamsLookup == nil { - return errors.New("is_streams_lookup must be set") - } - if *c.IsStreamsLookup { - if len(c.Feeds) == 0 { - return errors.New("feeds must be set") - } - } - - return nil -} - -type DataStreams struct { - Enabled *bool `toml:"enabled"` - URL *string `toml:"-"` - Username *string `toml:"-"` - Password *string `toml:"-"` - DefaultFeedID *string `toml:"default_feed_id"` -} - -func (c *DataStreams) Validate() error { - if c.Enabled != nil && *c.Enabled { - if c.URL == nil { - return errors.New("data_streams_url must be set") - } - if c.Username == nil { - return errors.New("data_streams_username must be set") - } - if c.Password == nil { - return errors.New("data_streams_password must be set") - } - if c.DefaultFeedID == nil { - return errors.New("data_streams_feed_id must be set") - } - } else { - c.Enabled = new(bool) - *c.Enabled = false - } - return nil -} - -type AutomationConfig struct { - PluginConfig *PluginConfig `toml:"PluginConfig"` - PublicConfig *PublicConfig `toml:"PublicConfig"` - RegistrySettings *RegistrySettings `toml:"RegistrySettings"` -} - -func (c *AutomationConfig) Validate() error { - if err := c.PluginConfig.Validate(); err != nil { - return err - } - if err := c.PublicConfig.Validate(); err != nil { - return err - } - return c.RegistrySettings.Validate() -} - -type PluginConfig struct { - PerformLockoutWindow *int64 `toml:"perform_lockout_window"` - TargetProbability *string `toml:"target_probability"` - TargetInRounds *int `toml:"target_in_rounds"` - MinConfirmations *int `toml:"min_confirmations"` - GasLimitPerReport *uint32 `toml:"gas_limit_per_report"` - GasOverheadPerUpkeep *uint32 `toml:"gas_overhead_per_upkeep"` - MaxUpkeepBatchSize *int `toml:"max_upkeep_batch_size"` - LogProviderConfig *LogProviderConfig `toml:"LogProviderConfig"` -} - -type LogProviderConfig struct { - BlockRate *uint32 `toml:"block_rate"` - LogLimit *uint32 `toml:"log_limit"` -} - -func (c *PluginConfig) Validate() error { - if err := c.LogProviderConfig.Validate(); err != nil { - return err - } - if c.PerformLockoutWindow == nil || *c.PerformLockoutWindow < 0 { - return errors.New("perform_lockout_window must be set to a non-negative integer") - } - if c.TargetProbability == nil || *c.TargetProbability == "" { - return errors.New("target_probability must be set") - } - if c.TargetInRounds == nil || *c.TargetInRounds < 1 { - return errors.New("target_in_rounds must be set to a positive integer") - } - if c.MinConfirmations == nil || *c.MinConfirmations < 0 { - return errors.New("min_confirmations must be set to a non-negative integer") - } - if c.GasLimitPerReport == nil || *c.GasLimitPerReport < 1 { - return errors.New("gas_limit_per_report must be set to a positive integer") - } - if c.GasOverheadPerUpkeep == nil || *c.GasOverheadPerUpkeep < 1 { - return errors.New("gas_overhead_per_upkeep must be set to a positive integer") - } - if c.MaxUpkeepBatchSize == nil || *c.MaxUpkeepBatchSize < 1 { - return errors.New("max_upkeep_batch_size must be set to a positive integer") - } - return nil -} - -func (c *LogProviderConfig) Validate() error { - if c.BlockRate == nil || *c.BlockRate < 1 { - return errors.New("block_rate must be set to a positive integer") - } - if c.LogLimit == nil || *c.LogLimit < 1 { - return errors.New("log_limit must be set to a positive integer") - } - return nil -} - -type PublicConfig struct { - DeltaProgress *time.Duration `toml:"delta_progress"` - DeltaResend *time.Duration `toml:"delta_resend"` - DeltaInitial *time.Duration `toml:"delta_initial"` - DeltaRound *time.Duration `toml:"delta_round"` - DeltaGrace *time.Duration `toml:"delta_grace"` - DeltaCertifiedCommitRequest *time.Duration `toml:"delta_certified_commit_request"` - DeltaStage *time.Duration `toml:"delta_stage"` - RMax *uint64 `toml:"r_max"` - F *int `toml:"f"` - MaxDurationQuery *time.Duration `toml:"max_duration_query"` - MaxDurationObservation *time.Duration `toml:"max_duration_observation"` - MaxDurationShouldAcceptAttestedReport *time.Duration `toml:"max_duration_should_accept_attested_report"` - MaxDurationShouldTransmitAcceptedReport *time.Duration `toml:"max_duration_should_transmit_accepted_report"` -} - -func (c *PublicConfig) Validate() error { - if c.DeltaProgress == nil || *c.DeltaProgress < 0 { - return errors.New("delta_progress must be set to a non-negative duration") - } - if c.DeltaResend == nil || *c.DeltaResend < 0 { - return errors.New("delta_resend must be set to a non-negative duration") - } - if c.DeltaInitial == nil || *c.DeltaInitial < 0 { - return errors.New("delta_initial must be set to a non-negative duration") - } - if c.DeltaRound == nil || *c.DeltaRound < 0 { - return errors.New("delta_round must be set to a non-negative duration") - } - if c.DeltaGrace == nil || *c.DeltaGrace < 0 { - return errors.New("delta_grace must be set to a non-negative duration") - } - if c.DeltaCertifiedCommitRequest == nil || *c.DeltaCertifiedCommitRequest < 0 { - return errors.New("delta_certified_commit_request must be set to a non-negative duration") - } - if c.DeltaStage == nil || *c.DeltaStage < 0 { - return errors.New("delta_stage must be set to a non-negative duration") - } - if c.RMax == nil || *c.RMax < 1 { - return errors.New("r_max must be set to a positive integer") - } - if c.F == nil || *c.F < 1 { - return errors.New("f must be set to a positive integer") - } - if c.MaxDurationQuery == nil || *c.MaxDurationQuery < 0 { - return errors.New("max_duration_query must be set to a non-negative duration") - } - if c.MaxDurationObservation == nil || *c.MaxDurationObservation < 0 { - return errors.New("max_duration_observation must be set to a non-negative duration") - } - if c.MaxDurationShouldAcceptAttestedReport == nil || *c.MaxDurationShouldAcceptAttestedReport < 0 { - return errors.New("max_duration_should_accept_attested_report must be set to a non-negative duration") - } - if c.MaxDurationShouldTransmitAcceptedReport == nil || *c.MaxDurationShouldTransmitAcceptedReport < 0 { - return errors.New("max_duration_should_transmit_accepted_report must be set to a non-negative duration") - } - return nil -} - -type RegistrySettings struct { - PaymentPremiumPPB *uint32 `toml:"payment_premium_ppb"` - FlatFeeMicroLINK *uint32 `toml:"flat_fee_micro_link"` - CheckGasLimit *uint32 `toml:"check_gas_limit"` - StalenessSeconds *big.Int `toml:"staleness_seconds"` - GasCeilingMultiplier *uint16 `toml:"gas_ceiling_multiplier"` - MaxPerformGas *uint32 `toml:"max_perform_gas"` - MinUpkeepSpend *big.Int `toml:"min_upkeep_spend"` - FallbackGasPrice *big.Int `toml:"fallback_gas_price"` - FallbackLinkPrice *big.Int `toml:"fallback_link_price"` - FallbackNativePrice *big.Int `toml:"fallback_native_price"` - MaxCheckDataSize *uint32 `toml:"max_check_data_size"` - MaxPerformDataSize *uint32 `toml:"max_perform_data_size"` - MaxRevertDataSize *uint32 `toml:"max_revert_data_size"` -} - -func (c *RegistrySettings) Validate() error { - if c.PaymentPremiumPPB == nil { - return errors.New("payment_premium_ppb must be set to a non-negative integer") - } - if c.FlatFeeMicroLINK == nil { - return errors.New("flat_fee_micro_link must be set to a non-negative integer") - } - if c.CheckGasLimit == nil || *c.CheckGasLimit < 1 { - return errors.New("check_gas_limit must be set to a positive integer") - } - if c.StalenessSeconds == nil || c.StalenessSeconds.Cmp(big.NewInt(0)) < 0 { - return errors.New("staleness_seconds must be set to a non-negative integer") - } - if c.GasCeilingMultiplier == nil { - return errors.New("gas_ceiling_multiplier must be set to a non-negative integer") - } - if c.MaxPerformGas == nil || *c.MaxPerformGas < 1 { - return errors.New("max_perform_gas must be set to a positive integer") - } - if c.MinUpkeepSpend == nil || c.MinUpkeepSpend.Cmp(big.NewInt(0)) < 0 { - return errors.New("min_upkeep_spend must be set to a non-negative integer") - } - if c.FallbackGasPrice == nil || c.FallbackGasPrice.Cmp(big.NewInt(0)) < 0 { - return errors.New("fallback_gas_price must be set to a non-negative integer") - } - if c.FallbackLinkPrice == nil || c.FallbackLinkPrice.Cmp(big.NewInt(0)) < 0 { - return errors.New("fallback_link_price must be set to a non-negative integer") - } - if c.FallbackNativePrice == nil || c.FallbackNativePrice.Cmp(big.NewInt(0)) < 0 { - return errors.New("fallback_native_price must be set to a non-negative integer") - } - if c.MaxCheckDataSize == nil || *c.MaxCheckDataSize < 1 { - return errors.New("max_check_data_size must be set to a positive integer") - } - if c.MaxPerformDataSize == nil || *c.MaxPerformDataSize < 1 { - return errors.New("max_perform_data_size must be set to a positive integer") - } - if c.MaxRevertDataSize == nil || *c.MaxRevertDataSize < 1 { - return errors.New("max_revert_data_size must be set to a positive integer") - } - return nil -} - -type ResiliencyConfig struct { - ContractCallLimit *uint `toml:"contract_call_limit"` - ContractCallInterval *blockchain.StrDuration `toml:"contract_call_interval"` -} - -func (c *ResiliencyConfig) Validate() error { - if c.ContractCallLimit == nil { - return errors.New("contract_call_limit must be set") - } - if c.ContractCallInterval == nil { - return errors.New("contract_call_interval must be set") - } - - return nil -} - -type Contracts struct { - ShouldBeUsed *bool `toml:"use"` - LinkTokenAddress *string `toml:"link_token"` - WethAddress *string `toml:"weth"` - TranscoderAddress *string `toml:"transcoder"` - ChainModuleAddress *string `toml:"chain_module"` - RegistryAddress *string `toml:"registry"` - RegistrarAddress *string `toml:"registrar"` - LinkEthFeedAddress *string `toml:"link_eth_feed"` - EthGasFeedAddress *string `toml:"eth_gas_feed"` - EthUSDFeedAddress *string `toml:"eth_usd_feed"` - LinkUSDFeedAddress *string `toml:"link_usd_feed"` - UpkeepContractAddresses []string `toml:"upkeep_contracts"` - MultiCallAddress *string `toml:"multicall"` - Settings map[string]ContractSetting `toml:"Settings"` -} - -func (o *Contracts) Validate() error { - if o.LinkTokenAddress != nil && !common.IsHexAddress(*o.LinkTokenAddress) { - return errors.New("link_token must be a valid ethereum address") - } - if o.WethAddress != nil && !common.IsHexAddress(*o.WethAddress) { - return errors.New("weth must be a valid ethereum address") - } - if o.TranscoderAddress != nil && !common.IsHexAddress(*o.TranscoderAddress) { - return errors.New("transcoder must be a valid ethereum address") - } - if o.ChainModuleAddress != nil && !common.IsHexAddress(*o.ChainModuleAddress) { - return errors.New("chain_module must be a valid ethereum address") - } - if o.RegistryAddress != nil && !common.IsHexAddress(*o.RegistryAddress) { - return errors.New("registry must be a valid ethereum address") - } - if o.RegistrarAddress != nil && !common.IsHexAddress(*o.RegistrarAddress) { - return errors.New("registrar must be a valid ethereum address") - } - if o.LinkEthFeedAddress != nil && !common.IsHexAddress(*o.LinkEthFeedAddress) { - return errors.New("link_eth_feed must be a valid ethereum address") - } - if o.EthGasFeedAddress != nil && !common.IsHexAddress(*o.EthGasFeedAddress) { - return errors.New("eth_gas_feed must be a valid ethereum address") - } - if o.EthUSDFeedAddress != nil && !common.IsHexAddress(*o.EthUSDFeedAddress) { - return errors.New("eth_usd_feed must be a valid ethereum address") - } - if o.LinkUSDFeedAddress != nil && !common.IsHexAddress(*o.LinkUSDFeedAddress) { - return errors.New("link_usd_feed must be a valid ethereum address") - } - if o.MultiCallAddress != nil && !common.IsHexAddress(*o.MultiCallAddress) { - return errors.New("multicall must be a valid ethereum address") - } - if o.UpkeepContractAddresses != nil { - allEnabled := make(map[bool]int) - allConfigure := make(map[bool]int) - for _, address := range o.UpkeepContractAddresses { - if !common.IsHexAddress(address) { - return fmt.Errorf("upkeep_contracts must be valid ethereum addresses, but %s is not", address) - } - - if v, ok := o.Settings[address]; ok { - if v.ShouldBeUsed != nil { - allEnabled[*v.ShouldBeUsed]++ - } else { - allEnabled[true]++ - } - if v.Configure != nil { - allConfigure[*v.Configure]++ - } else { - allConfigure[true]++ - } - } - } - - if allEnabled[true] > 0 && allEnabled[false] > 0 { - return errors.New("either all or none offchain_aggregators must be used") - } - - if allConfigure[true] > 0 && allConfigure[false] > 0 { - return errors.New("either all or none offchain_aggregators must be configured") - } - } - - return nil -} - -func (c *Config) UseExistingContracts() bool { - if c.Contracts == nil { - return false - } - - if c.Contracts.ShouldBeUsed != nil { - return *c.Contracts.ShouldBeUsed - } - - return false -} - -func (c *Config) LinkTokenContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.LinkTokenAddress != nil { - return common.HexToAddress(*c.Contracts.LinkTokenAddress), nil - } - - return common.Address{}, errors.New("link token address must be set") -} - -func (c *Config) WethContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.WethAddress != nil { - return common.HexToAddress(*c.Contracts.WethAddress), nil - } - - return common.Address{}, errors.New("weth address must be set") -} - -func (c *Config) TranscoderContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.TranscoderAddress != nil { - return common.HexToAddress(*c.Contracts.TranscoderAddress), nil - } - - return common.Address{}, errors.New("transcoder address must be set") -} - -func (c *Config) ChainModuleContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.ChainModuleAddress != nil { - return common.HexToAddress(*c.Contracts.ChainModuleAddress), nil - } - - return common.Address{}, errors.New("chain module address must be set") -} - -func (c *Config) RegistryContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.RegistryAddress != nil { - return common.HexToAddress(*c.Contracts.RegistryAddress), nil - } - - return common.Address{}, errors.New("registry address must be set") -} - -func (c *Config) RegistrarContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.RegistrarAddress != nil { - return common.HexToAddress(*c.Contracts.RegistrarAddress), nil - } - - return common.Address{}, errors.New("registrar address must be set") -} - -func (c *Config) LinkEthFeedContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.LinkEthFeedAddress != nil { - return common.HexToAddress(*c.Contracts.LinkEthFeedAddress), nil - } - - return common.Address{}, errors.New("link eth feed address must be set") -} - -func (c *Config) EthGasFeedContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.EthGasFeedAddress != nil { - return common.HexToAddress(*c.Contracts.EthGasFeedAddress), nil - } - - return common.Address{}, errors.New("eth gas feed address must be set") -} - -func (c *Config) EthUSDFeedContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.EthUSDFeedAddress != nil { - return common.HexToAddress(*c.Contracts.EthUSDFeedAddress), nil - } - - return common.Address{}, errors.New("eth usd feed address must be set") -} - -func (c *Config) LinkUSDFeedContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.LinkUSDFeedAddress != nil { - return common.HexToAddress(*c.Contracts.LinkUSDFeedAddress), nil - } - - return common.Address{}, errors.New("link usd feed address must be set") -} - -func (c *Config) UpkeepContractAddresses() ([]common.Address, error) { - if c.Contracts != nil && c.Contracts.UpkeepContractAddresses != nil { - addresses := make([]common.Address, len(c.Contracts.UpkeepContractAddresses)) - for i, address := range c.Contracts.UpkeepContractAddresses { - addresses[i] = common.HexToAddress(address) - } - return addresses, nil - } - - return nil, errors.New("upkeep contract addresses must be set") -} - -func (c *Config) MultiCallContractAddress() (common.Address, error) { - if c.Contracts != nil && c.Contracts.MultiCallAddress != nil { - return common.HexToAddress(*c.Contracts.MultiCallAddress), nil - } - - return common.Address{}, errors.New("multicall address must be set") -} - -func (c *Config) UseExistingLinkTokenContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.LinkTokenAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.LinkTokenAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingWethContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.WethAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.WethAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingTranscoderContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.TranscoderAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.TranscoderAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingRegistryContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.RegistryAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.RegistryAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingRegistrarContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.RegistrarAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.RegistrarAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingLinkEthFeedContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.LinkEthFeedAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.LinkEthFeedAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingEthGasFeedContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.EthGasFeedAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.EthGasFeedAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingEthUSDFeedContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.EthUSDFeedAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.EthUSDFeedAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingLinkUSDFeedContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.LinkUSDFeedAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.LinkUSDFeedAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -func (c *Config) UseExistingUpkeepContracts() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.UpkeepContractAddresses == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - for _, address := range c.Contracts.UpkeepContractAddresses { - if v, ok := c.Contracts.Settings[address]; ok { - if v.ShouldBeUsed != nil && *v.ShouldBeUsed { - return true - } - } - } - - return false -} - -func (c *Config) UseExistingMultiCallContract() bool { - if !c.UseExistingContracts() { - return false - } - - if c.Contracts.MultiCallAddress == nil { - return false - } - - if len(c.Contracts.Settings) == 0 { - return true - } - - if v, ok := c.Contracts.Settings[*c.Contracts.MultiCallAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -type ContractSetting struct { - ShouldBeUsed *bool `toml:"use"` - Configure *bool `toml:"configure"` -} diff --git a/integration-tests/testconfig/automation/example.toml b/integration-tests/testconfig/automation/example.toml deleted file mode 100644 index c239e5a3966..00000000000 --- a/integration-tests/testconfig/automation/example.toml +++ /dev/null @@ -1,129 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Product part -[Automation] -[Automation.General] -number_of_nodes=6 -duration=100 -block_time=1 -number_of_events=1 -spec_type="minimum" -chainlink_node_log_level="info" -use_prometheus=false - -# upgrade test specific override -[TestAutomationNodeUpgrade.ChainlinkUpgradeImage] -version="2.8.0" \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_1.toml b/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_1.toml deleted file mode 100644 index 0b704524e9d..00000000000 --- a/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_1.toml +++ /dev/null @@ -1,15 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Benchmark.Automation.Benchmark] -registry_to_test = "2_1" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 1000 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 3600 -block_interval = 60 -forces_single_tx_key = false -delete_jobs_on_end = true \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_3.toml b/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_3.toml deleted file mode 100644 index f00bb5ed47b..00000000000 --- a/integration-tests/testconfig/automation/overrides/benchmark/1000Upkeeps-1h-2_3.toml +++ /dev/null @@ -1,15 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Benchmark.Automation.Benchmark] -registry_to_test = "2_3" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 1000 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 3600 -block_interval = 60 -forces_single_tx_key = false -delete_jobs_on_end = true \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/load/500Upkeeps-1x-1h.toml b/integration-tests/testconfig/automation/overrides/load/500Upkeeps-1x-1h.toml deleted file mode 100644 index 6d58253f526..00000000000 --- a/integration-tests/testconfig/automation/overrides/load/500Upkeeps-1x-1h.toml +++ /dev/null @@ -1,47 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Load.Seth] -root_key_funds_buffer = 1_000_000 -ephemeral_addresses_number = 300 - -[Load.Seth.nonce_manager] -key_sync_timeout = "100s" - -[Load.Common] -chainlink_node_funding = 1000 - -[Load.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Load.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Load.Automation] -[Load.Automation.General] -number_of_nodes=6 -duration=3600 -block_time=1 -spec_type="recommended" -chainlink_node_log_level="debug" -use_prometheus=true -remove_namespace = true - -[Load.Automation.DataStreams] -enabled=false - -[[Load.Automation.Load]] -number_of_upkeeps=500 -number_of_events = 1 -number_of_spam_matching_events = 0 -number_of_spam_non_matching_events = 0 -check_burn_amount = 0 -perform_burn_amount = 0 -upkeep_gas_limit = 1000000 -shared_trigger = false -is_streams_lookup = false -feeds = [] - -[Pyroscope] -enabled=false \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-12h.toml b/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-12h.toml deleted file mode 100644 index 8991a6eb903..00000000000 --- a/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-12h.toml +++ /dev/null @@ -1,43 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Load.Seth] -root_key_funds_buffer = 1_000_000 - -[Load.Common] -chainlink_node_funding = 10000 - -[Load.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Load.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Load.Automation] -[Load.Automation.General] -number_of_nodes=6 -duration=43200 -block_time=1 -spec_type="recommended" -chainlink_node_log_level="debug" -use_prometheus=true -remove_namespace = true - -[Load.Automation.DataStreams] -enabled=false - -[[Load.Automation.Load]] -number_of_upkeeps=50 -number_of_events = 1 -number_of_spam_matching_events = 0 -number_of_spam_non_matching_events = 0 -check_burn_amount = 0 -perform_burn_amount = 0 -upkeep_gas_limit = 1000000 -shared_trigger = false -is_streams_lookup = false -feeds = [] - -[Pyroscope] -enabled=false \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-1h.toml b/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-1h.toml deleted file mode 100644 index a133fce6dcf..00000000000 --- a/integration-tests/testconfig/automation/overrides/load/50Upkeeps-1x-1h.toml +++ /dev/null @@ -1,43 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Load.Seth] -root_key_funds_buffer = 1_000_000 - -[Load.Common] -chainlink_node_funding = 1000 - -[Load.Automation.AutomationConfig] -use_log_buffer_v1=false - -[Load.Automation.AutomationConfig.PluginConfig.LogProviderConfig] -block_rate=1 -log_limit=2 - -[Load.Automation] -[Load.Automation.General] -number_of_nodes=6 -duration=3600 -block_time=1 -spec_type="recommended" -chainlink_node_log_level="debug" -use_prometheus=true -remove_namespace = true - -[Load.Automation.DataStreams] -enabled=false - -[[Load.Automation.Load]] -number_of_upkeeps=50 -number_of_events = 1 -number_of_spam_matching_events = 0 -number_of_spam_non_matching_events = 0 -check_burn_amount = 0 -perform_burn_amount = 0 -upkeep_gas_limit = 1000000 -shared_trigger = false -is_streams_lookup = false -feeds = [] - -[Pyroscope] -enabled=false \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_1.toml b/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_1.toml deleted file mode 100644 index fda5cb6ea29..00000000000 --- a/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_1.toml +++ /dev/null @@ -1,15 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Soak.Automation.Benchmark] -registry_to_test = "2_1" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 50 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 28800 -block_interval = 300 -forces_single_tx_key = false -delete_jobs_on_end = true \ No newline at end of file diff --git a/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_3.toml b/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_3.toml deleted file mode 100644 index 46ba1ad3e85..00000000000 --- a/integration-tests/testconfig/automation/overrides/soak/50Upkeeps-8h-2_3.toml +++ /dev/null @@ -1,15 +0,0 @@ -[ChainlinkImage] -version="latest" - -[Soak.Automation.Benchmark] -registry_to_test = "2_3" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 50 -upkeep_gas_limit = 1500000 -check_gas_to_burn = 10000 -perform_gas_to_burn = 1000 -block_range = 28800 -block_interval = 300 -forces_single_tx_key = false -delete_jobs_on_end = true \ No newline at end of file diff --git a/integration-tests/testconfig/common/vrf/common.go b/integration-tests/testconfig/common/vrf/common.go deleted file mode 100644 index f6f148a9eb4..00000000000 --- a/integration-tests/testconfig/common/vrf/common.go +++ /dev/null @@ -1,343 +0,0 @@ -package vrf - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" -) - -type Config struct { - General *General `toml:"General"` - ExistingEnvConfig *ExistingEnvConfig `toml:"ExistingEnv"` - Performance *PerformanceConfig `toml:"Performance"` -} - -const ( - ErrDeviationShouldBeLessThanOriginal = "`RandomnessRequestCountPerRequestDeviation` should be less than `RandomnessRequestCountPerRequest`" -) - -func (c *Config) Validate() error { - if c.General != nil { - if err := c.General.Validate(); err != nil { - return err - } - } - if c.ExistingEnvConfig != nil { - if err := c.ExistingEnvConfig.Validate(); err != nil { - return err - } - } - if c.Performance != nil { - if err := c.Performance.Validate(); err != nil { - return err - } - } - return nil -} - -type PerformanceConfig struct { - TestDuration *blockchain.StrDuration `toml:"test_duration"` - RPS *int64 `toml:"rps"` - RateLimitUnitDuration *blockchain.StrDuration `toml:"rate_limit_unit_duration"` - - BHSTestDuration *blockchain.StrDuration `toml:"bhs_test_duration"` - BHSTestRPS *int64 `toml:"bhs_test_rps"` - BHSTestRateLimitUnitDuration *blockchain.StrDuration `toml:"bhs_test_rate_limit_unit_duration"` -} - -func (c *PerformanceConfig) Validate() error { - if c.TestDuration == nil || c.TestDuration.Duration == 0 { - return errors.New("test_duration must be set to a positive value") - } - if c.RPS == nil || *c.RPS == 0 { - return errors.New("rps must be set to a positive value") - } - if c.RateLimitUnitDuration == nil { - return errors.New("rate_limit_unit_duration must be set ") - } - if c.BHSTestDuration == nil || c.BHSTestDuration.Duration == 0 { - return errors.New("bhs_test_duration must be set to a positive value") - } - if c.BHSTestRPS == nil || *c.BHSTestRPS == 0 { - return errors.New("bhs_test_rps must be set to a positive value") - } - if c.BHSTestRateLimitUnitDuration == nil { - return errors.New("bhs_test_rate_limit_unit_duration must be set ") - } - - return nil -} - -type ExistingEnvConfig struct { - CoordinatorAddress *string `toml:"coordinator_address"` - UseExistingWrapper *bool `toml:"use_existing_wrapper"` - WrapperAddress *string `toml:"wrapper_address"` - ConsumerAddress *string `toml:"consumer_address"` - WrapperConsumerAddress *string `toml:"wrapper_consumer_address"` - KeyHash *string `toml:"key_hash"` - CreateFundSubsAndAddConsumers *bool `toml:"create_fund_subs_and_add_consumers"` - CreateFundAddWrapperConsumers *bool `toml:"create_fund_add_wrapper_consumers"` - NodeSendingKeys []string `toml:"node_sending_keys"` - Funding -} - -func (c *ExistingEnvConfig) Validate() error { - if c.CreateFundSubsAndAddConsumers == nil { - return errors.New("create_fund_subs_and_add_consumers must be set ") - } - if c.CreateFundAddWrapperConsumers == nil { - return errors.New("create_fund_add_wrapper_consumers must be set ") - } - if c.CoordinatorAddress == nil { - return errors.New("coordinator_address must be set when using existing environment") - } - if !common.IsHexAddress(*c.CoordinatorAddress) { - return errors.New("coordinator_address must be a valid hex address") - } - if c.UseExistingWrapper == nil { - return errors.New("use_existing_wrapper must be set ") - } - if *c.UseExistingWrapper { - if c.WrapperAddress == nil { - return errors.New("wrapper_address must be set when using `use_existing_wrapper=true`") - } - if !common.IsHexAddress(*c.WrapperAddress) { - return errors.New("wrapper_address must be a valid hex address") - } - } - if c.KeyHash == nil { - return errors.New("key_hash must be set when using existing environment") - } - if *c.KeyHash == "" { - return errors.New("key_hash must be a non-empty string") - } - if !*c.CreateFundSubsAndAddConsumers { - if c.ConsumerAddress == nil || *c.ConsumerAddress == "" { - return errors.New("consumer_address must be set when using existing environment") - } - if !common.IsHexAddress(*c.ConsumerAddress) { - return errors.New("consumer_address must be a valid hex address") - } - } - if !*c.CreateFundAddWrapperConsumers { - if c.WrapperConsumerAddress == nil || *c.WrapperConsumerAddress == "" { - return errors.New("wrapper_consumer_address must be set when using existing environment") - } - if !common.IsHexAddress(*c.WrapperConsumerAddress) { - return errors.New("wrapper_consumer_address must be a valid hex address") - } - } - if c.NodeSendingKeys != nil { - for _, key := range c.NodeSendingKeys { - if !common.IsHexAddress(key) { - return errors.New("node_sending_keys must be a valid hex address") - } - } - } - return nil -} - -type Funding struct { - NodeSendingKeyFundingMin *float64 `toml:"node_sending_key_funding_min"` -} - -func (c *Funding) Validate() error { - if c.NodeSendingKeyFundingMin != nil && *c.NodeSendingKeyFundingMin <= 0 { - return errors.New("when set node_sending_key_funding_min must be a positive value") - } - return nil -} - -type General struct { - UseExistingEnv *bool `toml:"use_existing_env"` - CancelSubsAfterTestRun *bool `toml:"cancel_subs_after_test_run"` - CLNodeMaxGasPriceGWei *int64 `toml:"cl_node_max_gas_price_gwei"` // Max gas price in GWei for the chainlink node - LinkNativeFeedResponse *int64 `toml:"link_native_feed_response"` // Response of the LINK/ETH feed - MinimumConfirmations *uint16 `toml:"minimum_confirmations"` // Minimum number of confirmations for the VRF Coordinator - SubscriptionFundingAmountLink *float64 `toml:"subscription_funding_amount_link"` // Amount of LINK to fund the subscription with - SubscriptionRefundingAmountLink *float64 `toml:"subscription_refunding_amount_link"` // Amount of LINK to fund the subscription with - NumberOfWords *uint32 `toml:"number_of_words"` // Number of words to request - CallbackGasLimit *uint32 `toml:"callback_gas_limit"` // Gas limit for the callback - MaxGasLimitCoordinatorConfig *uint32 `toml:"max_gas_limit_coordinator_config"` // Max gas limit for the VRF Coordinator config - FallbackWeiPerUnitLink *string `toml:"fallback_wei_per_unit_link"` // Fallback wei per unit LINK for the VRF Coordinator config - StalenessSeconds *uint32 `toml:"staleness_seconds"` // Staleness in seconds for the VRF Coordinator config - GasAfterPaymentCalculation *uint32 `toml:"gas_after_payment_calculation"` // Gas after payment calculation for the VRF Coordinator - - NumberOfSubToCreate *int `toml:"number_of_sub_to_create"` // Number of subscriptions to create - NumberOfSendingKeysToCreate *int `toml:"number_of_sending_keys_to_create"` // Number of sending keys to create - - RandomnessRequestCountPerRequest *uint16 `toml:"randomness_request_count_per_request"` // How many randomness requests to send per request - RandomnessRequestCountPerRequestDeviation *uint16 `toml:"randomness_request_count_per_request_deviation"` // How many randomness requests to send per request - - RandomWordsFulfilledEventTimeout *blockchain.StrDuration `toml:"random_words_fulfilled_event_timeout"` // How long to wait for the RandomWordsFulfilled event to be emitted - WaitFor256BlocksTimeout *blockchain.StrDuration `toml:"wait_for_256_blocks_timeout"` // How long to wait for 256 blocks to be mined - - // Wrapper Config - WrapperGasOverhead *uint32 `toml:"wrapped_gas_overhead"` - WrapperMaxNumberOfWords *uint8 `toml:"wrapper_max_number_of_words"` - - WrapperConsumerFundingAmountNativeToken *float64 `toml:"wrapper_consumer_funding_amount_native_token"` - WrapperConsumerFundingAmountLink *int64 `toml:"wrapper_consumer_funding_amount_link"` - - // VRF Job Config - VRFJobForwardingAllowed *bool `toml:"vrf_job_forwarding_allowed"` - VRFJobEstimateGasMultiplier *float64 `toml:"vrf_job_estimate_gas_multiplier"` - VRFJobBatchFulfillmentEnabled *bool `toml:"vrf_job_batch_fulfillment_enabled"` - VRFJobBatchFulfillmentGasMultiplier *float64 `toml:"vrf_job_batch_fulfillment_gas_multiplier"` - VRFJobPollPeriod *blockchain.StrDuration `toml:"vrf_job_poll_period"` - VRFJobRequestTimeout *blockchain.StrDuration `toml:"vrf_job_request_timeout"` - VRFJobSimulationBlock *string `toml:"vrf_job_simulation_block"` - - // BHS Job Config - BHSJobWaitBlocks *int `toml:"bhs_job_wait_blocks"` - BHSJobLookBackBlocks *int `toml:"bhs_job_lookback_blocks"` - BHSJobPollPeriod *blockchain.StrDuration `toml:"bhs_job_poll_period"` - BHSJobRunTimeout *blockchain.StrDuration `toml:"bhs_job_run_timeout"` - - // BHF Job Config - BHFJobWaitBlocks *int `toml:"bhf_job_wait_blocks"` - BHFJobLookBackBlocks *int `toml:"bhf_job_lookback_blocks"` - BHFJobPollPeriod *blockchain.StrDuration `toml:"bhf_job_poll_period"` - BHFJobRunTimeout *blockchain.StrDuration `toml:"bhf_job_run_timeout"` - - GenerateTXsOnChain *bool `toml:"generate_txs_on_chain"` -} - -func (c *General) Validate() error { - if c.UseExistingEnv == nil { - return errors.New("use_existing_env must not be nil") - } - if c.CLNodeMaxGasPriceGWei == nil || *c.CLNodeMaxGasPriceGWei == 0 { - return errors.New("cl_node_max_gas_price_gwei must be set to a positive value") - } - if c.LinkNativeFeedResponse == nil || *c.LinkNativeFeedResponse == 0 { - return errors.New("link_native_feed_response must be set to a positive value") - } - if c.MinimumConfirmations == nil { - return errors.New("minimum_confirmations must be set to a non-negative value") - } - if c.SubscriptionFundingAmountLink == nil || *c.SubscriptionFundingAmountLink < 0 { - return errors.New("subscription_funding_amount_link must be set to non-negative value") - } - if c.SubscriptionRefundingAmountLink == nil || *c.SubscriptionRefundingAmountLink < 0 { - return errors.New("subscription_refunding_amount_link must be set to non-negative value") - } - if c.NumberOfWords == nil || *c.NumberOfWords == 0 { - return errors.New("number_of_words must be set to a positive value") - } - if c.CallbackGasLimit == nil || *c.CallbackGasLimit == 0 { - return errors.New("callback_gas_limit must be set to a positive value") - } - if c.MaxGasLimitCoordinatorConfig == nil || *c.MaxGasLimitCoordinatorConfig == 0 { - return errors.New("max_gas_limit_coordinator_config must be set to a positive value") - } - if c.FallbackWeiPerUnitLink == nil { - return errors.New("fallback_wei_per_unit_link must be set") - } - if c.StalenessSeconds == nil || *c.StalenessSeconds == 0 { - return errors.New("staleness_seconds must be set to a positive value") - } - if c.GasAfterPaymentCalculation == nil || *c.GasAfterPaymentCalculation == 0 { - return errors.New("gas_after_payment_calculation must be set to a positive value") - } - if c.NumberOfSubToCreate == nil || *c.NumberOfSubToCreate == 0 { - return errors.New("number_of_sub_to_create must be set to a positive value") - } - - if c.NumberOfSendingKeysToCreate == nil || *c.NumberOfSendingKeysToCreate < 0 { - return errors.New("number_of_sending_keys_to_create must be set to 0 or a positive value") - } - - if c.RandomnessRequestCountPerRequest == nil || *c.RandomnessRequestCountPerRequest == 0 { - return errors.New("randomness_request_count_per_request must be set to a positive value") - } - if c.RandomnessRequestCountPerRequestDeviation == nil { - return errors.New("randomness_request_count_per_request_deviation must be set to a non-negative value") - } - if c.RandomWordsFulfilledEventTimeout == nil || c.RandomWordsFulfilledEventTimeout.Duration == 0 { - return errors.New("random_words_fulfilled_event_timeout must be set to a positive value") - } - if c.WaitFor256BlocksTimeout == nil || c.WaitFor256BlocksTimeout.Duration == 0 { - return errors.New("wait_for_256_blocks_timeout must be set to a positive value") - } - if c.WrapperGasOverhead == nil { - return errors.New("wrapped_gas_overhead must be set to a non-negative value") - } - if c.WrapperMaxNumberOfWords == nil || *c.WrapperMaxNumberOfWords == 0 { - return errors.New("wrapper_max_number_of_words must be set to a positive value") - } - if c.WrapperConsumerFundingAmountNativeToken == nil || *c.WrapperConsumerFundingAmountNativeToken < 0 { - return errors.New("wrapper_consumer_funding_amount_native_token must be set to a non-negative value") - } - if c.WrapperConsumerFundingAmountLink == nil || *c.WrapperConsumerFundingAmountLink < 0 { - return errors.New("wrapper_consumer_funding_amount_link must be set to a non-negative value") - } - if *c.RandomnessRequestCountPerRequest <= *c.RandomnessRequestCountPerRequestDeviation { - return errors.New(ErrDeviationShouldBeLessThanOriginal) - } - - if c.VRFJobForwardingAllowed == nil { - return errors.New("vrf_job_forwarding_allowed must be set") - } - - if c.VRFJobBatchFulfillmentEnabled == nil { - return errors.New("vrf_job_batch_fulfillment_enabled must be set") - } - if c.VRFJobEstimateGasMultiplier == nil || *c.VRFJobEstimateGasMultiplier < 0 { - return errors.New("vrf_job_estimate_gas_multiplier must be set to a non-negative value") - } - if c.VRFJobBatchFulfillmentGasMultiplier == nil || *c.VRFJobBatchFulfillmentGasMultiplier < 0 { - return errors.New("vrf_job_batch_fulfillment_gas_multiplier must be set to a non-negative value") - } - - if c.VRFJobPollPeriod == nil || c.VRFJobPollPeriod.Duration == 0 { - return errors.New("vrf_job_poll_period must be set to a non-negative value") - } - - if c.VRFJobRequestTimeout == nil || c.VRFJobRequestTimeout.Duration == 0 { - return errors.New("vrf_job_request_timeout must be set to a non-negative value") - } - - if c.VRFJobSimulationBlock != nil && (*c.VRFJobSimulationBlock != "latest" && *c.VRFJobSimulationBlock != "pending") { - return errors.New("simulation_block must be nil or \"latest\" or \"pending\"") - } - - if c.BHSJobLookBackBlocks == nil || *c.BHSJobLookBackBlocks < 0 { - return errors.New("bhs_job_lookback_blocks must be set to a non-negative value") - } - - if c.BHSJobPollPeriod == nil || c.BHSJobPollPeriod.Duration == 0 { - return errors.New("bhs_job_poll_period must be set to a non-negative value") - } - - if c.BHSJobRunTimeout == nil || c.BHSJobRunTimeout.Duration == 0 { - return errors.New("bhs_job_run_timeout must be set to a non-negative value") - } - - if c.BHSJobWaitBlocks == nil || *c.BHSJobWaitBlocks < 0 { - return errors.New("bhs_job_wait_blocks must be set to a non-negative value") - } - - if c.BHFJobLookBackBlocks == nil || *c.BHFJobLookBackBlocks < 0 { - return errors.New("bhf_job_lookback_blocks must be set to a non-negative value") - } - - if c.BHFJobPollPeriod == nil || c.BHFJobPollPeriod.Duration == 0 { - return errors.New("bhf_job_poll_period must be set to a non-negative value") - } - - if c.BHFJobRunTimeout == nil || c.BHFJobRunTimeout.Duration == 0 { - return errors.New("bhf_job_run_timeout must be set to a non-negative value") - } - - if c.BHFJobWaitBlocks == nil || *c.BHFJobWaitBlocks < 0 { - return errors.New("bhf_job_wait_blocks must be set to a non-negative value") - } - - if c.GenerateTXsOnChain == nil { - return errors.New("generate_txs_on_chain must not be nil") - } - - return nil -} diff --git a/integration-tests/testconfig/configs_embed.go b/integration-tests/testconfig/configs_embed.go index 5de81acb7d9..d29b17b4187 100644 --- a/integration-tests/testconfig/configs_embed.go +++ b/integration-tests/testconfig/configs_embed.go @@ -6,18 +6,6 @@ package testconfig import "embed" //go:embed default.toml -//go:embed automation/automation.toml -//go:embed forwarder_ocr/forwarder_ocr.toml -//go:embed forwarder_ocr2/forwarder_ocr2.toml -//go:embed functions/functions.toml -//go:embed keeper/keeper.toml -//go:embed log_poller/log_poller.toml -//go:embed node/node.toml -//go:embed ocr/ocr.toml -//go:embed ocr2/ocr2.toml -//go:embed vrf/vrf.toml -//go:embed vrfv2/vrfv2.toml -//go:embed vrfv2plus/vrfv2plus.toml //go:embed ccip/ccip.toml var embeddedConfigsFs embed.FS diff --git a/integration-tests/testconfig/forwarder_ocr/example.toml b/integration-tests/testconfig/forwarder_ocr/example.toml deleted file mode 100644 index 6ca4b8bbcc3..00000000000 --- a/integration-tests/testconfig/forwarder_ocr/example.toml +++ /dev/null @@ -1,135 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true -DefaultTransactionQueueDepth = 0 - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -[OCR.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR] -[Soak.OCR.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml b/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml deleted file mode 100644 index 68ed21404f3..00000000000 --- a/integration-tests/testconfig/forwarder_ocr/forwarder_ocr.toml +++ /dev/null @@ -1,102 +0,0 @@ -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true -DefaultTransactionQueueDepth = 0 - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" - -CommonChainConfigTOML = """ -[Transactions] -ForwardersEnabled = true -""" - -[NodeConfig.ChainConfigTOMLByChainID] -1337 = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[Transactions] -ForwardersEnabled = true -""" - -[OCR.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# volume test specific configuration -[Volume.OCR] -[Volume.OCR.Common] -eth_funds = 3 - -[Volume.OCR.Volume] -test_duration = "3m" -rate_limit_unit_duration = "1m" -vu_requests_per_unit = 10 -rate = 1 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 0.5 - -[Soak.OCR] -[Soak.OCR.Common] -number_of_contracts=2 -test_duration = "15m" - -[Soak.OCR.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/forwarder_ocr2/example.toml b/integration-tests/testconfig/forwarder_ocr2/example.toml deleted file mode 100644 index e3fb66a0f3a..00000000000 --- a/integration-tests/testconfig/forwarder_ocr2/example.toml +++ /dev/null @@ -1,136 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -image="public.ecr.aws/chainlink/chainlink" -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true -DefaultTransactionQueueDepth = 0 - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -[OCR2.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR2] -[Load.OCR2.Common] -eth_funds = 3 - -[Load.OCR2.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR2] -[Soak.OCR2.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR2.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml b/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml deleted file mode 100644 index 76d5695a8b6..00000000000 --- a/integration-tests/testconfig/forwarder_ocr2/forwarder_ocr2.toml +++ /dev/null @@ -1,97 +0,0 @@ -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true -DefaultTransactionQueueDepth = 0 - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -CommonChainConfigTOML = """ -[Transactions] -ForwardersEnabled = true -""" - -[NodeConfig.ChainConfigTOMLByChainID] -1337 = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[Transactions] -ForwardersEnabled = true -""" - -[OCR2.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR2.Common] -eth_funds = 3 - -[Load.OCR2.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# volume test specific configuration -[Volume.OCR2.Common] -eth_funds = 3 - -[Volume.OCR2.Volume] -test_duration = "3m" -rate_limit_unit_duration = "1m" -vu_requests_per_unit = 10 -rate = 1 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR2.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR2.Soak] -time_between_rounds="1m" - - diff --git a/integration-tests/testconfig/functions/config.go b/integration-tests/testconfig/functions/config.go deleted file mode 100644 index 03adc2f1ec0..00000000000 --- a/integration-tests/testconfig/functions/config.go +++ /dev/null @@ -1,118 +0,0 @@ -package functions - -import ( - "errors" - "math/big" - - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/net" -) - -const ( - ErrReadPerfConfig = "failed to read TOML config for performance tests" - ErrUnmarshalPerfConfig = "failed to unmarshal TOML config for performance tests" -) - -type Config struct { - Performance *Performance `toml:"Performance"` - Common *Common `toml:"Common"` -} - -type Common struct { - NodeFunds *big.Float `toml:"node_funds"` - SubFunds *big.Int `toml:"sub_funds"` - LINKTokenAddr *string `toml:"link_token_addr"` - Coordinator *string `toml:"coordinator_addr"` - Router *string `toml:"router_addr"` - LoadTestClient *string `toml:"client_addr"` - SubscriptionID *uint64 `toml:"subscription_id"` - DONID *string `toml:"don_id"` - GatewayURL *string `toml:"gateway_url"` - Receiver *string `toml:"receiver"` - FunctionsCallPayloadHTTP *string `toml:"functions_call_payload_http"` - FunctionsCallPayloadWithSecrets *string `toml:"functions_call_payload_with_secrets"` - FunctionsCallPayloadReal *string `toml:"functions_call_payload_real"` - SecretsSlotID *uint8 `toml:"secrets_slot_id"` - SecretsVersionID *uint64 `toml:"secrets_version_id"` - // Secrets these are for CI secrets - Secrets *string `toml:"secrets"` -} - -func (c *Common) Validate() error { - if c.SubFunds == nil { - return errors.New("sub_funds must be set") - } - if c.LINKTokenAddr == nil || *c.LINKTokenAddr == "" { - return errors.New("link_token_addr must be set") - } - if !common.IsHexAddress(*c.LINKTokenAddr) { - return errors.New("link_token_addr must be a valid address") - } - if c.Coordinator == nil || *c.Coordinator == "" { - return errors.New("coordinator must be set") - } - if !common.IsHexAddress(*c.Coordinator) { - return errors.New("coordinator must be a valid address") - } - if c.Router == nil || *c.Router == "" { - return errors.New("router must be set") - } - if !common.IsHexAddress(*c.Router) { - return errors.New("router must be a valid address") - } - if c.DONID == nil || *c.DONID == "" { - return errors.New("don_id must be set") - } - if c.GatewayURL == nil || *c.GatewayURL == "" { - return errors.New("gateway_url must be set") - } - if !net.IsValidURL(*c.GatewayURL) { - return errors.New("gateway_url must be a valid URL") - } - if c.Receiver == nil || *c.Receiver == "" { - return errors.New("receiver must be set") - } - if !common.IsHexAddress(*c.Receiver) { - return errors.New("receiver must be a valid address") - } - return nil -} - -type Performance struct { - RPS *int64 `toml:"rps"` - RequestsPerCall *uint32 `toml:"requests_per_call"` - Duration *blockchain.StrDuration `toml:"duration"` -} - -func (c *Performance) Validate() error { - if c.RPS == nil || *c.RPS < 1 { - return errors.New("rps must be greater than 0") - } - if c.RequestsPerCall != nil && *c.RequestsPerCall < 1 { - return errors.New("requests_per_call must be greater than 0") - } - if c.Duration == nil || c.Duration.Duration < 1 { - return errors.New("duration must be greater than 0") - } - return nil -} - -func (c *Config) Validate() error { - if c == nil { - return nil - } - if c.Common != nil { - if err := c.Common.Validate(); err != nil { - return err - } - } - if c.Performance != nil { - if err := c.Performance.Validate(); err != nil { - return err - } - } - - return nil -} diff --git a/integration-tests/testconfig/functions/example.toml b/integration-tests/testconfig/functions/example.toml deleted file mode 100644 index ec7076fa9f9..00000000000 --- a/integration-tests/testconfig/functions/example.toml +++ /dev/null @@ -1,153 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use simulated network -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Product part -[Functions] -[Functions.Common] -# Polygon Mumbai only for now -receiver = "0x3098B6665589959711A48a6bAe5B7F2908f6a3bE" -don_id = "fun-staging-mumbai-1" -gateway_url = "https://gateway-stg-one.main.stage.cldev.sh" -link_token_addr = "0x326C977E6efc84E512bB9C30f76E30c160eD06FB" -coordinator_addr = "0x6D6a83BB356b7242E88C1A2b290102fde26590D0" -router_addr = "0x2673266D3Cd08b53494B5a92B66DEec7F1408E7A" - -# comment "client_addr" and "subscription_id" and test will create a new pair -# get it from logs and save -client_addr = "0x89D4b58D859a536D0B888ecD5093eF5FF9e4F977" -subscription_id = 47 -sub_funds = 10 - -functions_call_payload_with_secrets = "return Functions.encodeString(JSON.stringify(secrets))" -functions_call_payload_http = """ -const response = await Functions.makeHttpRequest({ url: 'http://dummyjson.com/products/1' }); -return Functions.encodeUint256(response.data.id); -""" -functions_call_payload_real = """ -const arg1 = args[0]; -const arg2 = args[1]; -const arg3 = args[2]; -const arg4 = args[3]; - -const response = await Functions.makeHttpRequest({ url: 'http://dummyjson.com/products/${arg1}' }); -return Functions.encodeString(JSON.stringify(secrets)); -""" -secrets_slot_id = 0 -secrets_version_id = 1693945705 - -[Functions.Performance] -rps = 95 -requests_per_call = 20 -duration = "10m" \ No newline at end of file diff --git a/integration-tests/testconfig/functions/functions.toml b/integration-tests/testconfig/functions/functions.toml deleted file mode 100644 index a4bcb6439e4..00000000000 --- a/integration-tests/testconfig/functions/functions.toml +++ /dev/null @@ -1,91 +0,0 @@ -# product defaults -[Functions] -[Functions.Common] -# Polygon Mumbai only for now -receiver = "0x3098B6665589959711A48a6bAe5B7F2908f6a3bE" -don_id = "fun-staging-mumbai-1" -gateway_url = "https://gateway-stg-one.main.stage.cldev.sh" -link_token_addr = "0x326C977E6efc84E512bB9C30f76E30c160eD06FB" -coordinator_addr = "0x6D6a83BB356b7242E88C1A2b290102fde26590D0" -router_addr = "0x2673266D3Cd08b53494B5a92B66DEec7F1408E7A" - -# comment "client_addr" and "subscription_id" and test will create a new pair -# get it from logs and save -client_addr = "0x89D4b58D859a536D0B888ecD5093eF5FF9e4F977" -subscription_id = 47 -sub_funds = 10 - -functions_call_payload_with_secrets = "return Functions.encodeString(JSON.stringify(secrets))" -functions_call_payload_http = """ -const response = await Functions.makeHttpRequest({ url: 'http://dummyjson.com/products/1' }); -return Functions.encodeUint256(response.data.id); -""" -functions_call_payload_real = """ -const arg1 = args[0]; -const arg2 = args[1]; -const arg3 = args[2]; -const arg4 = args[3]; - -const response = await Functions.makeHttpRequest({ url: 'http://dummyjson.com/products/${arg1}' }); -return Functions.encodeString(JSON.stringify(secrets)); -""" -secrets_slot_id = 0 -secrets_version_id = 1693945705 - -# uncomment to upload new secrets to s4 and use it in your run -# TODO: not working now -#secrets = "{\"secrets\": \"secretValue\"}" - -# gateway-list specific test configuration -[GatewayList.Functions] -[GatewayList.Functions.Performance] -rps = 95 -duration = "10m" - -# gateway-set specific test configuration -[GatewaySet.Functions] -[GatewaySet.Functions.Performance] -rps = 95 -duration = "10m" - -# real-soak specific test configuration -[RealSoak.Functions] -[RealSoak.Functions.Performance] -rps = 1 -requests_per_call = 20 -duration = "10m" - -# real-stress specific test configuration -[RealStress.Functions] -[RealStress.Functions.Performance] -rps = 1 -requests_per_call = 40 -duration = "10m" - -# secrets-soak specific test configuration -[SecretsSoak.Functions] -[SecretsSoak.Functions.Performance] -rps = 1 -requests_per_call = 20 -duration = "10m" - -# secrets-stress specific test configuration -[SecretsStress.Functions] -[SecretsStress.Functions.Performance] -rps = 1 -requests_per_call = 40 -duration = "10m" - -# soak specific test configuration -[Soak.Functions] -[Soak.Functions.Performance] -rps = 1 -requests_per_call = 40 -duration = "10m" - -# soak specific test configuration -[Stress.Functions] -[Stress.Functions.Performance] -rps = 1 -requests_per_call = 78 -duration = "10m" \ No newline at end of file diff --git a/integration-tests/testconfig/job_distributor/job_distributor.toml b/integration-tests/testconfig/job_distributor/job_distributor.toml deleted file mode 100644 index 6dae45fb140..00000000000 --- a/integration-tests/testconfig/job_distributor/job_distributor.toml +++ /dev/null @@ -1,46 +0,0 @@ -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true -MultiFeedsManagers = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true -DefaultTransactionQueueDepth = 0 - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" diff --git a/integration-tests/testconfig/keeper/config.go b/integration-tests/testconfig/keeper/config.go deleted file mode 100644 index 81a88ef67eb..00000000000 --- a/integration-tests/testconfig/keeper/config.go +++ /dev/null @@ -1,8 +0,0 @@ -package keeper - -type Config struct { -} - -func (c *Config) Validate() error { - return nil -} diff --git a/integration-tests/testconfig/keeper/example.toml b/integration-tests/testconfig/keeper/example.toml deleted file mode 100644 index 7fe3bf26d0a..00000000000 --- a/integration-tests/testconfig/keeper/example.toml +++ /dev/null @@ -1,129 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[Keeper] -TurnLookBack = 0 -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Product part -[Common] -chainlink_node_funding = 0.5 - -[Keeper.Common] -registry_to_test = "2_1" -number_of_registries = 1 -number_of_nodes = 6 -number_of_upkeeps = 500 -upkeep_gas_limit = 150000 -check_gas_to_burn = 100000 -perform_gas_to_burn = 50000 -max_perform_gas = 5000000 -block_range = 3600 -block_interval = 20 -forces_single_tx_key = false -delete_jobs_on_end = true - -# If present will wrap keeper benchmakr consumers in retrying contract backend -# that retries read-only operations on failure related to network issues or node unavailability -# To disable simply remove this section or set any of the values to 0 -[Keeper.Resiliency] -# number of retries before giving up -contract_call_limit = 500 -# static interval between retries -contract_call_interval = "5s" \ No newline at end of file diff --git a/integration-tests/testconfig/keeper/keeper.toml b/integration-tests/testconfig/keeper/keeper.toml deleted file mode 100644 index d483d6df493..00000000000 --- a/integration-tests/testconfig/keeper/keeper.toml +++ /dev/null @@ -1,35 +0,0 @@ -# product defaults -[Common] -chainlink_node_funding = 0.5 - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Keeper] -TurnLookBack = 0 -""" \ No newline at end of file diff --git a/integration-tests/testconfig/log_poller/config.go b/integration-tests/testconfig/log_poller/config.go deleted file mode 100644 index c41787832be..00000000000 --- a/integration-tests/testconfig/log_poller/config.go +++ /dev/null @@ -1,154 +0,0 @@ -package logpoller - -import ( - "errors" - "fmt" - - "github.com/ethereum/go-ethereum/accounts/abi" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" -) - -type GeneratorType = string - -const ( - GeneratorType_WASP = "wasp" - GeneratorType_Looped = "looped" -) - -type Config struct { - General *General `toml:"General"` - ChaosConfig *ChaosConfig `toml:"Chaos"` - Wasp *WaspConfig `toml:"Wasp"` - LoopedConfig *LoopedConfig `toml:"Looped"` -} - -func (c *Config) Validate() error { - if c.General == nil { - return errors.New("General config must be set") - } - - err := c.General.Validate() - if err != nil { - return fmt.Errorf("General config validation failed: %w", err) - } - - switch *c.General.Generator { - case GeneratorType_WASP: - if c.Wasp == nil { - return errors.New("wasp config is nil") - } - err = c.Wasp.Validate() - if err != nil { - return fmt.Errorf("wasp config validation failed: %w", err) - } - case GeneratorType_Looped: - if c.LoopedConfig == nil { - return errors.New("looped config is nil") - } - err = c.LoopedConfig.Validate() - if err != nil { - return fmt.Errorf("looped config validation failed: %w", err) - } - default: - return fmt.Errorf("unknown generator type: %s", *c.General.Generator) - } - - if c.ChaosConfig != nil { - if err := c.ChaosConfig.Validate(); err != nil { - return fmt.Errorf("chaos config validation failed: %w", err) - } - } - - return nil -} - -type LoopedConfig struct { - ExecutionCount *int `toml:"execution_count"` - MinEmitWaitTimeMs *int `toml:"min_emit_wait_time_ms"` - MaxEmitWaitTimeMs *int `toml:"max_emit_wait_time_ms"` -} - -func (l *LoopedConfig) Validate() error { - if l.ExecutionCount == nil || *l.ExecutionCount == 0 { - return errors.New("execution_count must be set and > 0") - } - - if l.MinEmitWaitTimeMs == nil || *l.MinEmitWaitTimeMs == 0 { - return errors.New("min_emit_wait_time_ms must be set and > 0") - } - - if l.MaxEmitWaitTimeMs == nil || *l.MaxEmitWaitTimeMs == 0 { - return errors.New("max_emit_wait_time_ms must be set and > 0") - } - - return nil -} - -type General struct { - Generator *string `toml:"generator"` - EventsToEmit []abi.Event `toml:"-"` - Contracts *int `toml:"contracts"` - EventsPerTx *int `toml:"events_per_tx"` - UseFinalityTag *bool `toml:"use_finality_tag"` -} - -func (g *General) Validate() error { - if g.Generator == nil || *g.Generator == "" { - return errors.New("generator is empty") - } - - if g.Contracts == nil || *g.Contracts == 0 { - return errors.New("contracts is 0, but must be > 0") - } - - if g.EventsPerTx == nil || *g.EventsPerTx == 0 { - return errors.New("events_per_tx is 0, but must be > 0") - } - - return nil -} - -type ChaosConfig struct { - ExperimentCount *int `toml:"experiment_count"` - TargetComponent *string `toml:"target_component"` -} - -func (c *ChaosConfig) Validate() error { - if c.ExperimentCount != nil && *c.ExperimentCount == 0 { - return errors.New("experiment_count must be > 0") - } - - return nil -} - -type WaspConfig struct { - RPS *int64 `toml:"rps"` - LPS *int64 `toml:"lps"` - RateLimitUnitDuration *blockchain.StrDuration `toml:"rate_limit_unit_duration"` - Duration *blockchain.StrDuration `toml:"duration"` - CallTimeout *blockchain.StrDuration `toml:"call_timeout"` -} - -func (w *WaspConfig) Validate() error { - if w.RPS == nil && w.LPS == nil { - return errors.New("either RPS or LPS needs to be set") - } - if *w.RPS == 0 && *w.LPS == 0 { - return errors.New("either RPS or LPS needs to be a positive integer") - } - if *w.RPS != 0 && *w.LPS != 0 { - return errors.New("only one of RPS or LPS can be set") - } - if w.Duration == nil || w.Duration.Duration == 0 { - return errors.New("duration must be set and > 0") - } - if w.CallTimeout == nil || w.CallTimeout.Duration == 0 { - return errors.New("call_timeout must be set and > 0") - } - if w.RateLimitUnitDuration == nil || w.RateLimitUnitDuration.Duration == 0 { - return errors.New("rate_limit_unit_duration must be set and > 0") - } - - return nil -} diff --git a/integration-tests/testconfig/log_poller/example.toml b/integration-tests/testconfig/log_poller/example.toml deleted file mode 100644 index b94b6e0e202..00000000000 --- a/integration-tests/testconfig/log_poller/example.toml +++ /dev/null @@ -1,134 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[Keeper] -TurnLookBack = 0 - -[Keeper.Registry] -PerformGasOverhead = 150000 -SyncInterval = '5m0s' - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Product part -[LogPoller] -[LogPoller.General] -generator = "looped" -contracts = 2 -events_per_tx = 4 -use_finality_tag = true - -[LogPoller.Looped] -execution_count = 100 -min_emit_wait_time_ms = 200 -max_emit_wait_time_ms = 500 \ No newline at end of file diff --git a/integration-tests/testconfig/log_poller/log_poller.toml b/integration-tests/testconfig/log_poller/log_poller.toml deleted file mode 100644 index 74ba9ecc237..00000000000 --- a/integration-tests/testconfig/log_poller/log_poller.toml +++ /dev/null @@ -1,195 +0,0 @@ -[PrivateEthereumNetwork] -ethereum_version="eth2" -consensus_layer="prysm" - -[PrivateEthereumNetwork.EthereumChainConfig] -seconds_per_slot=4 -slots_per_epoch=2 - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[Keeper] -TurnLookBack = 0 - -[Keeper.Registry] -PerformGasOverhead = 150000 -SyncInterval = '5m0s' - -[P2P] -[P2P.V2] -Enabled = true -ListenAddresses = ['0.0.0.0:6690'] -AnnounceAddresses = ['0.0.0.0:6690'] -DeltaDial = '500ms' -DeltaReconcile = '5s' -""" - -# Chainlnk node settings that will be used by all tests -# BackupLogPollerBlockDelay = 0 disables the backup log poller -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityTagEnabled = true -SafeTagSupported = true -""" - -[Seth] -ephemeral_addresses_number = 50 - -# product defaults -[LogPoller] -[LogPoller.General] -generator = "looped" -contracts = 2 -events_per_tx = 4 -use_finality_tag = true - -[LogPoller.Looped] -execution_count = 100 -min_emit_wait_time_ms = 400 -max_emit_wait_time_ms = 600 - -# test-specific -[TestLogPollerFewFiltersFixedDepth.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" -[TestLogPollerFewFiltersFixedDepth.LogPoller.General] -use_finality_tag = false - -[TestLogManyFiltersPollerFinalityTag.LogPoller.General] -contracts = 300 -events_per_tx = 3 - -[TestLogManyFiltersPollerFinalityTag.LogPoller.Looped] -execution_count = 30 - -[TestLogManyFiltersPollerFixedDepth.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" - -[TestLogManyFiltersPollerFixedDepth.LogPoller.General] -use_finality_tag = false -contracts = 300 -events_per_tx = 3 - -[TestLogManyFiltersPollerFixedDepth.LogPoller.Looped] -execution_count = 30 - -[TestLogPollerWithChaosFinalityTag.LogPoller.General] -execution_count = 30 -[TestLogPollerWithChaosFinalityTag.LogPoller.Chaos] -experiment_count = 4 -target_component = "chainlink" - -[TestLogPollerWithChaosFixedDepth.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" - -[TestLogPollerWithChaosFixedDepth.LogPoller.General] -execution_count = 30 -use_finality_tag = false -[TestLogPollerWithChaosFixedDepth.LogPoller.Chaos] -experiment_count = 4 -target_component = "chainlink" - -[TestLogPollerWithChaosPostgresFinalityTag.LogPoller.General] -execution_count = 30 -[TestLogPollerWithChaosPostgresFinalityTag.LogPoller.Chaos] -experiment_count = 4 -target_component = "postgres" - -[TestLogPollerWithChaosPostgresFixedDepth.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" - -[TestLogPollerWithChaosPostgresFixedDepth.LogPoller.General] -execution_count = 30 -use_finality_tag = false -[TestLogPollerWithChaosPostgresFixedDepth.LogPoller.Chaos] -experiment_count = 4 -target_component = "postgres" - -[TestLogPollerReplayFixedDepth.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" -[TestLogPollerReplayFixedDepth.LogPoller.General] -use_finality_tag = false - -[TestReorgAboveFinality_FinalityTagDisabled.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 10 -FinalityTagEnabled = false -""" -[TestReorgAboveFinality_FinalityTagDisabled.PrivateEthereumNetwork] -ethereum_version = "eth1" -execution_layer = "geth" diff --git a/integration-tests/testconfig/node/example.toml b/integration-tests/testconfig/node/example.toml deleted file mode 100644 index 4635e40c037..00000000000 --- a/integration-tests/testconfig/node/example.toml +++ /dev/null @@ -1,43 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Test-specific part -[ChainlinkUpgradeImage] -version="2.8.0" \ No newline at end of file diff --git a/integration-tests/testconfig/node/node.toml b/integration-tests/testconfig/node/node.toml deleted file mode 100644 index 683b55a35a1..00000000000 --- a/integration-tests/testconfig/node/node.toml +++ /dev/null @@ -1,5 +0,0 @@ -# original image -[ChainlinkImage] - -# image to upgrade to -[ChainlinkUpgradeImage] \ No newline at end of file diff --git a/integration-tests/testconfig/ocr/example.toml b/integration-tests/testconfig/ocr/example.toml deleted file mode 100644 index d1edd3a67fd..00000000000 --- a/integration-tests/testconfig/ocr/example.toml +++ /dev/null @@ -1,134 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -[OCR.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR] -[Soak.OCR.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/ocr/ocr.go b/integration-tests/testconfig/ocr/ocr.go deleted file mode 100644 index 240fd2afeaa..00000000000 --- a/integration-tests/testconfig/ocr/ocr.go +++ /dev/null @@ -1,298 +0,0 @@ -package ocr - -import ( - "errors" - "fmt" - - "github.com/ethereum/go-ethereum/common" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" -) - -type Config struct { - Soak *SoakConfig `toml:"Soak"` - Load *Load `toml:"Load"` - Volume *Volume `toml:"Volume"` - Common *Common `toml:"Common"` - Contracts *Contracts `toml:"Contracts"` -} - -func (o *Config) Validate() error { - if o.Common != nil { - if err := o.Common.Validate(); err != nil { - return err - } - } - if o.Soak != nil { - if err := o.Soak.Validate(); err != nil { - return err - } - } - if o.Volume != nil { - if err := o.Volume.Validate(); err != nil { - return err - } - } - if o.Contracts != nil { - if err := o.Contracts.Validate(); err != nil { - return err - } - } - return nil -} - -type Common struct { - NumberOfContracts *int `toml:"number_of_contracts"` - ETHFunds *int `toml:"eth_funds"` - TestDuration *blockchain.StrDuration `toml:"test_duration"` -} - -func (o *Common) Validate() error { - if o.NumberOfContracts != nil && *o.NumberOfContracts < 1 { - return errors.New("when number_of_contracts is set, it must be greater than 0") - } - if o.ETHFunds != nil && *o.ETHFunds < 0 { - return errors.New("eth_funds must be set and cannot be negative") - } - return nil -} - -type Load struct { - Rate *int64 `toml:"rate"` - RequestsPerUnit *int `toml:"requests_per_unit"` - RateLimitUnitDuration *blockchain.StrDuration `toml:"rate_limit_unit_duration"` - VerificationInterval *blockchain.StrDuration `toml:"verification_interval"` - VerificationTimeout *blockchain.StrDuration `toml:"verification_timeout"` - EAChangeInterval *blockchain.StrDuration `toml:"ea_change_interval"` - TestDuration *blockchain.StrDuration `toml:"test_duration"` -} - -func (o *Load) Validate() error { - if o.TestDuration == nil { - return errors.New("load test duration must be set") - } - if o.Rate == nil || *o.Rate <= 0 { - return errors.New("rate must be set and be a positive integer") - } - if o.RequestsPerUnit == nil || *o.RequestsPerUnit <= 0 { - return errors.New("vu_requests_per_unit must be set and be a positive integer") - } - if o.RateLimitUnitDuration == nil || o.RateLimitUnitDuration.Duration == 0 { - return errors.New("rate_limit_unit_duration must be set and be a positive integer") - } - if o.VerificationInterval == nil || o.VerificationInterval.Duration == 0 { - return errors.New("verification_interval must be set and be a positive integer") - } - if o.VerificationTimeout == nil || o.VerificationTimeout.Duration == 0 { - return errors.New("verification_timeout must be set and be a positive integer") - } - if o.EAChangeInterval == nil || o.EAChangeInterval.Duration == 0 { - return errors.New("ea_change_interval must be set and be a positive integer") - } - - return nil -} - -type Volume struct { - Rate *int64 `toml:"rate"` - VURequestsPerUnit *int `toml:"vu_requests_per_unit"` - RateLimitUnitDuration *blockchain.StrDuration `toml:"rate_limit_unit_duration"` - VerificationInterval *blockchain.StrDuration `toml:"verification_interval"` - VerificationTimeout *blockchain.StrDuration `toml:"verification_timeout"` - EAChangeInterval *blockchain.StrDuration `toml:"ea_change_interval"` - TestDuration *blockchain.StrDuration `toml:"test_duration"` -} - -func (o *Volume) Validate() error { - if o.TestDuration == nil { - return errors.New("volume test duration must be set") - } - if o.Rate == nil || *o.Rate <= 0 { - return errors.New("rate must be set and be a positive integer") - } - if o.VURequestsPerUnit == nil || *o.VURequestsPerUnit <= 0 { - return errors.New("vu_requests_per_unit must be set and be a positive integer") - } - if o.RateLimitUnitDuration == nil || o.RateLimitUnitDuration.Duration == 0 { - return errors.New("rate_limit_unit_duration must be set and be a positive integer") - } - if o.VerificationInterval == nil || o.VerificationInterval.Duration == 0 { - return errors.New("verification_interval must be set and be a positive integer") - } - if o.VerificationTimeout == nil || o.VerificationTimeout.Duration == 0 { - return errors.New("verification_timeout must be set and be a positive integer") - } - if o.EAChangeInterval == nil || o.EAChangeInterval.Duration == 0 { - return errors.New("ea_change_interval must be set and be a positive integer") - } - - return nil -} - -type SoakConfig struct { - TimeBetweenRounds *blockchain.StrDuration `toml:"time_between_rounds"` -} - -func (o *SoakConfig) Validate() error { - if o.TimeBetweenRounds == nil || o.TimeBetweenRounds.Duration == 0 { - return errors.New("time_between_rounds must be set and be a positive integer") - } - return nil -} - -// For more information on the configuration of contracts, see https://smartcontract-it.atlassian.net/wiki/spaces/TT/pages/828407894/Contracts+addresses+in+TOML+convention -type Contracts struct { - ShouldBeUsed *bool `toml:"use"` - LinkTokenAddress *string `toml:"link_token"` - OffChainAggregatorAddresses []string `toml:"offchain_aggregators"` - Settings map[string]ContractSetting `toml:"Settings"` -} - -func (o *Contracts) Validate() error { - if o.LinkTokenAddress != nil && !common.IsHexAddress(*o.LinkTokenAddress) { - return errors.New("link_token must be a valid ethereum address") - } - if o.OffChainAggregatorAddresses != nil { - allEnabled := make(map[bool]int) - allConfigure := make(map[bool]int) - for _, address := range o.OffChainAggregatorAddresses { - if !common.IsHexAddress(address) { - return fmt.Errorf("offchain_aggregators must be valid ethereum addresses, but %s is not", address) - } - - if v, ok := o.Settings[address]; ok { - if v.ShouldBeUsed != nil { - allEnabled[*v.ShouldBeUsed]++ - } else { - allEnabled[true]++ - } - if v.Configure != nil { - allConfigure[*v.Configure]++ - } else { - allConfigure[true]++ - } - } - } - - if allEnabled[true] > 0 && allEnabled[false] > 0 { - return errors.New("either all or none offchain_aggregators must be used") - } - - if allConfigure[true] > 0 && allConfigure[false] > 0 { - return errors.New("either all or none offchain_aggregators must be configured") - } - } - - return nil -} - -func (o *Config) UseExistingContracts() bool { - if o.Contracts == nil { - return false - } - - if o.Contracts.ShouldBeUsed != nil { - return *o.Contracts.ShouldBeUsed - } - - return false -} - -func (o *Config) LinkTokenContractAddress() (common.Address, error) { - if o.Contracts != nil && o.Contracts.LinkTokenAddress != nil { - return common.HexToAddress(*o.Contracts.LinkTokenAddress), nil - } - - return common.Address{}, errors.New("link token address must be set") -} - -func (o *Config) UseExistingLinkTokenContract() bool { - if !o.UseExistingContracts() { - return false - } - - if o.Contracts.LinkTokenAddress == nil { - return false - } - - if len(o.Contracts.Settings) == 0 { - return true - } - - if v, ok := o.Contracts.Settings[*o.Contracts.LinkTokenAddress]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - - return true -} - -type ContractSetting struct { - ShouldBeUsed *bool `toml:"use"` - Configure *bool `toml:"configure"` -} - -type OffChainAggregatorsConfig interface { - OffChainAggregatorsContractsAddresses() []common.Address - UseExistingOffChainAggregatorsContracts() bool - ConfigureExistingOffChainAggregatorsContracts() bool - NumberOfContractsToDeploy() int -} - -func (o *Config) UseExistingOffChainAggregatorsContracts() bool { - if !o.UseExistingContracts() { - return false - } - - if len(o.Contracts.OffChainAggregatorAddresses) == 0 { - return false - } - - if len(o.Contracts.Settings) == 0 { - return true - } - - for _, address := range o.Contracts.OffChainAggregatorAddresses { - if v, ok := o.Contracts.Settings[address]; ok { - return v.ShouldBeUsed != nil && *v.ShouldBeUsed - } - } - - return true -} - -func (o *Config) OffChainAggregatorsContractsAddresses() []common.Address { - var ocrInstanceAddresses []common.Address - if !o.UseExistingOffChainAggregatorsContracts() { - return ocrInstanceAddresses - } - - for _, address := range o.Contracts.OffChainAggregatorAddresses { - ocrInstanceAddresses = append(ocrInstanceAddresses, common.HexToAddress(address)) - } - - return ocrInstanceAddresses -} - -func (o *Config) ConfigureExistingOffChainAggregatorsContracts() bool { - if !o.UseExistingOffChainAggregatorsContracts() { - return true - } - - for _, address := range o.Contracts.OffChainAggregatorAddresses { - for maybeOcrAddress, setting := range o.Contracts.Settings { - if maybeOcrAddress == address { - return setting.Configure != nil && *setting.Configure - } - } - } - - return true -} - -func (o *Config) NumberOfContractsToDeploy() int { - if o.Common != nil && o.Common.NumberOfContracts != nil { - return *o.Common.NumberOfContracts - } - - return 0 -} diff --git a/integration-tests/testconfig/ocr/ocr.toml b/integration-tests/testconfig/ocr/ocr.toml deleted file mode 100644 index 846adf63aeb..00000000000 --- a/integration-tests/testconfig/ocr/ocr.toml +++ /dev/null @@ -1,194 +0,0 @@ -# product defaults -[Common] -chainlink_node_funding = 0.5 - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -[OCR.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR] -[Load.OCR.Common] -eth_funds = 3 - -[Load.OCR.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# volume test specific configuration -[Volume.OCR] -[Volume.OCR.Common] -eth_funds = 3 - -[Volume.OCR.Volume] -test_duration = "3m" -rate_limit_unit_duration = "1m" -vu_requests_per_unit = 10 -rate = 1 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 0.5 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration="15m" -number_of_contracts=2 - -[Soak.OCR.Soak] -time_between_rounds="1m" - -# Soak test configuration with Geth reorg below finality with FinalityTagEnabled=false -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityDepth = 30 -FinalityTagEnabled = false -""" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Network] -selected_networks=["simulated"] -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Network.GethReorgConfig] -enabled = true -depth = 15 -delay_create = "3s" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR] -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR.Common] -test_duration="15m" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" - -# Soak test configuration with Geth reorg below finality with FinalityTagEnabled=true -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.NodeConfig] -CommonChainConfigTOML = """ -AutoCreateKey = true -MinContractPayment = 0 -LogPollInterval="500ms" -BackupLogPollerBlockDelay = 0 -FinalityTagEnabled = true -SafeTagSupported = true - -[HeadTracker] -HistoryDepth = 10 -""" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Network] -selected_networks=["simulated"] -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Network.GethReorgConfig] -enabled = true -depth = 15 -delay_create = "3s" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR] -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR.Common] -test_duration="15m" -[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" - - -# OCR soak test configuration with gas spike on Anvil network -[TestOCRSoak_GasSpike.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_GasSpike.OCR.Common] -test_duration="15m" -[TestOCRSoak_GasSpike.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" -[TestOCRSoak_GasSpike.Network] -selected_networks=["Anvil"] -[TestOCRSoak_GasSpike.Network.AnvilConfigs.anvil.GasSpikeSimulation] -enabled = true -start_gas_price = 2000000000 -gas_rise_percentage = 0.7 -gas_spike = true -delay_create = "1m" -duration = "3m" - -# OCR soak test configuration with change to gas limit on Anvil network -[TestOCRSoak_ChangeBlockGasLimit.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_ChangeBlockGasLimit.OCR.Common] -test_duration="15m" -[TestOCRSoak_ChangeBlockGasLimit.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" -[TestOCRSoak_ChangeBlockGasLimit.Network] -selected_networks=["Anvil"] -[TestOCRSoak_ChangeBlockGasLimit.Network.AnvilConfigs.anvil.GasLimitSimulation] -enabled = true -next_gas_limit_percentage = 0.5 -delay_create = "1m" -duration = "3m" - -[TestOCRSoak_RPCDownForAllCLNodes.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_RPCDownForAllCLNodes.OCR.Common] -test_duration="15m" -[TestOCRSoak_RPCDownForAllCLNodes.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" -[TestOCRSoak_RPCDownForAllCLNodes.Network] -selected_networks=["simulated"] - -[TestOCRSoak_RPCDownForHalfCLNodes.Common] -chainlink_node_funding = 0.5 -[TestOCRSoak_RPCDownForHalfCLNodes.OCR.Common] -test_duration="15m" -[TestOCRSoak_RPCDownForHalfCLNodes.OCR.Soak] -number_of_contracts=2 -time_between_rounds="1m" -[TestOCRSoak_RPCDownForHalfCLNodes.Network] -selected_networks=["simulated"] \ No newline at end of file diff --git a/integration-tests/testconfig/ocr/overrides/arbitrum_mainnet.toml b/integration-tests/testconfig/ocr/overrides/arbitrum_mainnet.toml deleted file mode 100644 index 953d9f351a4..00000000000 --- a/integration-tests/testconfig/ocr/overrides/arbitrum_mainnet.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["ARBITRUM_MAINNET"] - -[Soak.Common] -chainlink_node_funding = 0.1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "10m" - -[OCR.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr/overrides/arbitrum_sepolia.toml b/integration-tests/testconfig/ocr/overrides/arbitrum_sepolia.toml deleted file mode 100644 index 1428e50b0e3..00000000000 --- a/integration-tests/testconfig/ocr/overrides/arbitrum_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["ARBITRUM_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/base_mainnet.toml b/integration-tests/testconfig/ocr/overrides/base_mainnet.toml deleted file mode 100644 index a285c23758e..00000000000 --- a/integration-tests/testconfig/ocr/overrides/base_mainnet.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["BASE_MAINNET"] - -[Soak.Common] -chainlink_node_funding = 5 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "10m" - -[OCR.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr/overrides/base_sepolia.toml b/integration-tests/testconfig/ocr/overrides/base_sepolia.toml deleted file mode 100644 index 3dbbadcbef2..00000000000 --- a/integration-tests/testconfig/ocr/overrides/base_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["BASE_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/celo_alfajores.toml b/integration-tests/testconfig/ocr/overrides/celo_alfajores.toml deleted file mode 100644 index 37c4a8cf16d..00000000000 --- a/integration-tests/testconfig/ocr/overrides/celo_alfajores.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["CELO_ALFAJORES"] - -[Soak.Common] -chainlink_node_funding = 10 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/ethereum_sepolia.toml b/integration-tests/testconfig/ocr/overrides/ethereum_sepolia.toml deleted file mode 100644 index 612e47506a7..00000000000 --- a/integration-tests/testconfig/ocr/overrides/ethereum_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/hedera_testnet.toml b/integration-tests/testconfig/ocr/overrides/hedera_testnet.toml deleted file mode 100755 index 9741dbef36c..00000000000 --- a/integration-tests/testconfig/ocr/overrides/hedera_testnet.toml +++ /dev/null @@ -1,48 +0,0 @@ -[ChainlinkImage] -version = "283fe46b1d149c57ef2c70e6d5a1520dbc5b482e" - -[Network] -selected_networks = ["HEDERA_TESTNET"] - -[Soak.Common] -chainlink_node_funding = 30 -number_of_contracts = 2 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "240m" - -[Soak.OCR2.Soak] -ocr_version = "2" -number_of_contracts = 2 -time_between_rounds = "5m" - -[Seth] -pending_nonce_protection_enabled = true - -[Network.EVMNetworks.HEDERA_TESTNET] -evm_name = "HEDERA_TESTNET" -evm_chain_id = 296 -client_implementation = "Ethereum" -evm_simulated = false -evm_chainlink_transaction_limit = 5000 -evm_minimum_confirmations = 1 -evm_gas_estimation_buffer = 100000 -evm_supports_eip1559 = false -evm_default_gas_limit = 6000000 - -[[Seth.networks]] -name = "HEDERA_TESTNET" -transaction_timeout = "2m" -transfer_gas_fee = 800_000 -gas_limit = 2_000_000 -# legacy transactions -gas_price = 2_500_000_000_000 -# EIP-1559 transactions -eip_1559_dynamic_fees = false -gas_fee_cap = 109_694_825_437 -gas_tip_cap = 30_000_000_000 -# if set to true we will estimate gas for every transaction -gas_price_estimation_enabled = false -# how many last blocks to use, when estimating gas for a transaction -gas_price_estimation_blocks = 0 \ No newline at end of file diff --git a/integration-tests/testconfig/ocr/overrides/linea_sepolia.toml b/integration-tests/testconfig/ocr/overrides/linea_sepolia.toml deleted file mode 100644 index 6fa6218d541..00000000000 --- a/integration-tests/testconfig/ocr/overrides/linea_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["Linea_Sepolia"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/optimism_mainnet.toml b/integration-tests/testconfig/ocr/overrides/optimism_mainnet.toml deleted file mode 100644 index eec0640baa3..00000000000 --- a/integration-tests/testconfig/ocr/overrides/optimism_mainnet.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["OPTIMISM_MAINNET"] - -[Soak.Common] -chainlink_node_funding = 0.1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "10m" - -[OCR.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr/overrides/optimism_sepolia.toml b/integration-tests/testconfig/ocr/overrides/optimism_sepolia.toml deleted file mode 100644 index fe666b6aa9e..00000000000 --- a/integration-tests/testconfig/ocr/overrides/optimism_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["OPTIMISM_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/scroll_sepolia.toml b/integration-tests/testconfig/ocr/overrides/scroll_sepolia.toml deleted file mode 100644 index 0beedfd05ea..00000000000 --- a/integration-tests/testconfig/ocr/overrides/scroll_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["SCROLL_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "2m" - -[OCR.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr/overrides/wemix_mainnet.toml b/integration-tests/testconfig/ocr/overrides/wemix_mainnet.toml deleted file mode 100644 index 4a7859db3c9..00000000000 --- a/integration-tests/testconfig/ocr/overrides/wemix_mainnet.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["WEMIX_MAINNET"] - -[Soak.Common] -chainlink_node_funding = 5 - -[Soak.OCR] -[Soak.OCR.Common] -test_duration = "24h" - -[Soak.OCR.Soak] -time_between_rounds = "10m" - -[OCR.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr2/example.toml b/integration-tests/testconfig/ocr2/example.toml deleted file mode 100644 index 679e4527a31..00000000000 --- a/integration-tests/testconfig/ocr2/example.toml +++ /dev/null @@ -1,134 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -[OCR2.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR2] -[Load.OCR2.Common] -eth_funds = 3 - -[Load.OCR2.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 100 - -[Soak.OCR2] -[Soak.OCR.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR2.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/ocr2/ocr2.go b/integration-tests/testconfig/ocr2/ocr2.go deleted file mode 100644 index 60169e944fa..00000000000 --- a/integration-tests/testconfig/ocr2/ocr2.go +++ /dev/null @@ -1,30 +0,0 @@ -package ocr2 - -import ( - "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ocr" -) - -type Config struct { - Soak *ocr.SoakConfig `toml:"Soak"` - Common *ocr.Common `toml:"Common"` - Contracts *ocr.Contracts `toml:"Contracts"` -} - -func (o *Config) Validate() error { - if o.Common != nil { - if err := o.Common.Validate(); err != nil { - return err - } - } - if o.Soak != nil { - if err := o.Soak.Validate(); err != nil { - return err - } - } - if o.Contracts != nil { - if err := o.Contracts.Validate(); err != nil { - return err - } - } - return nil -} diff --git a/integration-tests/testconfig/ocr2/ocr2.toml b/integration-tests/testconfig/ocr2/ocr2.toml deleted file mode 100644 index 62d92574ea8..00000000000 --- a/integration-tests/testconfig/ocr2/ocr2.toml +++ /dev/null @@ -1,86 +0,0 @@ -# product defaults -[Common] -chainlink_node_funding = 0.5 - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR2] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -[OCR2.Common] -number_of_contracts=1 - -# load test specific configuration -[Load.OCR2] -[Load.OCR2.Common] -eth_funds = 3 - -[Load.OCR2.Load] -test_duration = "3m" -rate_limit_unit_duration = "1m" -rate = 3 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# volume test specific configuration -[Volume.OCR2] -[Volume.OCR2.Common] -eth_funds = 3 - -[Volume.OCR2.Volume] -test_duration = "3m" -rate_limit_unit_duration = "1m" -vu_requests_per_unit = 10 -rate = 1 -verification_interval = "5s" -verification_timeout = "3m" -ea_change_interval = "5s" - -# soak test specific configuration -[Soak.Common] -chainlink_node_funding = 0.5 - -[Soak.OCR2] -[Soak.OCR2.Common] -number_of_contracts=2 -test_duration="15m" - -[Soak.OCR2.Soak] -time_between_rounds="1m" diff --git a/integration-tests/testconfig/ocr2/overrides/base_sepolia.toml b/integration-tests/testconfig/ocr2/overrides/base_sepolia.toml deleted file mode 100644 index 76e4fc4722d..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/base_sepolia.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["BASE_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr2/overrides/base_sepolia_quick_smoke_test.toml b/integration-tests/testconfig/ocr2/overrides/base_sepolia_quick_smoke_test.toml deleted file mode 100644 index f4dfe76994b..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/base_sepolia_quick_smoke_test.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["BASE_SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "10m" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr2/overrides/celo_alfajores.toml b/integration-tests/testconfig/ocr2/overrides/celo_alfajores.toml deleted file mode 100644 index 73995ddc0b5..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/celo_alfajores.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["CELO_ALFAJORES"] - -[Soak.Common] -chainlink_node_funding = 2 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia.toml b/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia.toml deleted file mode 100644 index f7e02407808..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia_12h.toml b/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia_12h.toml deleted file mode 100644 index 18c0a1d7381..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/ethereum_sepolia_12h.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[Soak.Common] -chainlink_node_funding = 0.3 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "12h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr2/overrides/polygon_amoy.toml b/integration-tests/testconfig/ocr2/overrides/polygon_amoy.toml deleted file mode 100644 index 41a31897c5f..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/polygon_amoy.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["POLYGON_AMOY"] - -[Soak.Common] -chainlink_node_funding = 20 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr2/overrides/polygon_mainnet.toml b/integration-tests/testconfig/ocr2/overrides/polygon_mainnet.toml deleted file mode 100644 index 51da2793133..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/polygon_mainnet.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["POLYGON_MAINNET"] - -[Soak.Common] -chainlink_node_funding = 5 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "10m" - -[OCR2.Common] -number_of_contracts = 2 - -[Seth] -experiments_enabled = ["slow_funds_return"] diff --git a/integration-tests/testconfig/ocr2/overrides/wemix_testnet.toml b/integration-tests/testconfig/ocr2/overrides/wemix_testnet.toml deleted file mode 100644 index 82bc06c17ee..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/wemix_testnet.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["WEMIX_TESTNET"] - -[Soak.Common] -chainlink_node_funding = 10 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/ocr2/overrides/xlayer_sepolia.toml b/integration-tests/testconfig/ocr2/overrides/xlayer_sepolia.toml deleted file mode 100644 index d58098c5b0f..00000000000 --- a/integration-tests/testconfig/ocr2/overrides/xlayer_sepolia.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["xlayer_sepolia"] - -[Soak.Common] -chainlink_node_funding = 1 - -[Soak.OCR2] -[Soak.OCR2.Common] -test_duration = "24h" - -[Soak.OCR2.Soak] -time_between_rounds = "2m" - -[OCR2.Common] -number_of_contracts = 2 diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index b712ca6c769..e141df942f3 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -9,9 +9,6 @@ import ( "strconv" "strings" - "github.com/barkimedes/go-deepcopy" - "github.com/ethereum/go-ethereum/common" - "github.com/google/uuid" "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -27,82 +24,14 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/conversions" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/osutil" - a_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/automation" ccip_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ccip" - f_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/functions" - keeper_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/keeper" - lp_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/log_poller" - ocr_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/ocr" - vrf_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrf" - vrfv2_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2" - vrfv2plus_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" -) - -type UpgradeableChainlinkTestConfig interface { - GetChainlinkUpgradeImageConfig() *ctf_config.ChainlinkImageConfig -} - -type CommonTestConfig interface { - GetCommonConfig() *Common -} - -type VRFv2TestConfig interface { - GetVRFv2Config() *vrfv2_config.Config -} - -type VRFv2PlusTestConfig interface { - GetVRFv2PlusConfig() *vrfv2plus_config.Config -} - -type FunctionsTestConfig interface { - GetFunctionsConfig() *f_config.Config -} - -type KeeperTestConfig interface { - GetKeeperConfig() *keeper_config.Config -} - -type AutomationTestConfig interface { - GetAutomationConfig() *a_config.Config -} - -type OcrTestConfig interface { - GetActiveOCRConfig() *ocr_config.Config -} - -type Ocr2TestConfig interface { - GetOCR2Config() *ocr_config.Config -} - -type CCIPTestConfig interface { - GetCCIPConfig() *ccip_config.Config -} - -type LinkTokenContractConfig interface { - LinkTokenContractAddress() (common.Address, error) - UseExistingLinkTokenContract() bool -} - -const ( - E2E_TEST_DATA_STREAMS_URL_ENV = "E2E_TEST_DATA_STREAMS_URL" - E2E_TEST_DATA_STREAMS_USERNAME_ENV = "E2E_TEST_DATA_STREAMS_USERNAME" - E2E_TEST_DATA_STREAMS_PASSWORD_ENV = "E2E_TEST_DATA_STREAMS_PASSWORD" ) type TestConfig struct { ctf_config.TestConfig - Common *Common `toml:"Common"` - Automation *a_config.Config `toml:"Automation"` - Functions *f_config.Config `toml:"Functions"` - Keeper *keeper_config.Config `toml:"Keeper"` - LogPoller *lp_config.Config `toml:"LogPoller"` - OCR *ocr_config.Config `toml:"OCR"` - OCR2 *ocr_config.Config `toml:"OCR2"` - VRF *vrf_config.Config `toml:"VRF"` - VRFv2 *vrfv2_config.Config `toml:"VRFv2"` - VRFv2Plus *vrfv2plus_config.Config `toml:"VRFv2Plus"` - CCIP *ccip_config.Config `toml:"CCIP"` + Common *Common `toml:"Common"` + CCIP *ccip_config.Config `toml:"CCIP"` ConfigurationNames []string `toml:"-"` } @@ -137,37 +66,6 @@ func (c *TestConfig) GetGrafanaDashboardURL() (string, error) { return url, nil } -// Saves Test Config to a local file -func (c *TestConfig) Save() (string, error) { - filePath := fmt.Sprintf("test_config-%s.toml", uuid.New()) - - content, err := toml.Marshal(*c) - if err != nil { - return "", errors.Wrapf(err, "error marshaling test config") - } - - err = os.WriteFile(filePath, content, 0600) - if err != nil { - return "", errors.Wrapf(err, "error writing test config") - } - - return filePath, nil -} - -// MustCopy Returns a deep copy of the Test Config or panics on error -func (c TestConfig) MustCopy() any { - return deepcopy.MustAnything(c).(TestConfig) -} - -// MustCopy Returns a deep copy of struct passed to it and returns a typed copy (or panics on error) -func MustCopy[T any](c T) T { - return deepcopy.MustAnything(c).(T) -} - -func (c *TestConfig) GetLoggingConfig() *ctf_config.LoggingConfig { - return c.Logging -} - func (c TestConfig) GetNetworkConfig() *ctf_config.NetworkConfig { return c.Network } @@ -184,67 +82,10 @@ func (c TestConfig) GetPyroscopeConfig() *ctf_config.PyroscopeConfig { return c.Pyroscope } -func (c TestConfig) GetCommonConfig() *Common { - return c.Common -} - -func (c TestConfig) GetVRFv2Config() *vrfv2_config.Config { - return c.VRFv2 -} - -func (c TestConfig) GetFunctionsConfig() *f_config.Config { - return c.Functions -} - -func (c TestConfig) GetVRFv2PlusConfig() *vrfv2plus_config.Config { - return c.VRFv2Plus -} - -func (c TestConfig) GetChainlinkUpgradeImageConfig() *ctf_config.ChainlinkImageConfig { - return c.ChainlinkUpgradeImage -} - -func (c TestConfig) GetKeeperConfig() *keeper_config.Config { - return c.Keeper -} - -func (c TestConfig) GetAutomationConfig() *a_config.Config { - return c.Automation -} - -func (c TestConfig) GetOCRConfig() *ocr_config.Config { - return c.OCR -} - -func (c TestConfig) GetCCIPConfig() *ccip_config.Config { - return c.CCIP -} - -func (c TestConfig) GetConfigurationNames() []string { - return c.ConfigurationNames -} - func (c TestConfig) GetSethConfig() *seth.Config { return c.Seth } -func (c TestConfig) GetActiveOCRConfig() *ocr_config.Config { - if c.OCR != nil { - return c.OCR - } - - return c.OCR2 -} - -func (c *TestConfig) AsBase64() (string, error) { - content, err := toml.Marshal(*c) - if err != nil { - return "", errors.Wrapf(err, "error marshaling test config") - } - - return base64.StdEncoding.EncodeToString(content), nil -} - type Common struct { ChainlinkNodeFunding *float64 `toml:"chainlink_node_funding"` } @@ -260,36 +101,9 @@ func (c *Common) Validate() error { type Product string const ( - Automation Product = "automation" - Cron Product = "cron" - Flux Product = "flux" - ForwarderOcr Product = "forwarder_ocr" - ForwarderOcr2 Product = "forwarder_ocr2" - Functions Product = "functions" - Keeper Product = "keeper" - LogPoller Product = "log_poller" - Node Product = "node" - OCR Product = "ocr" - OCR2 Product = "ocr2" - RunLog Product = "runlog" - VRF Product = "vrf" - VRFv2 Product = "vrfv2" - VRFv2Plus Product = "vrfv2plus" - CCIP Product = "ccip" ) -const TestTypeEnvVarName = "TEST_TYPE" - -func GetConfigurationNameFromEnv() (string, error) { - testType := os.Getenv(TestTypeEnvVarName) - if testType == "" { - return "", fmt.Errorf("%s env var not set", TestTypeEnvVarName) - } - - return cases.Title(language.English, cases.NoLower).String(testType), nil -} - const ( Base64OverrideEnvVarName = k8s_config.EnvBase64ConfigOverride ) @@ -447,50 +261,10 @@ func GetConfig(configurationNames []string, product Product, extraFileNames ...s // Read config values from environment variables func (c *TestConfig) ReadFromEnvVar() error { - logger := logging.GetTestLogger(nil) - - // Read values for base config from env vars err := c.TestConfig.ReadFromEnvVar() if err != nil { return errors.Wrapf(err, "error reading test config values from env vars") } - - dsURL := ctf_config.MustReadEnvVar_String(E2E_TEST_DATA_STREAMS_URL_ENV) - if dsURL != "" { - if c.Automation == nil { - c.Automation = &a_config.Config{} - } - if c.Automation.DataStreams == nil { - c.Automation.DataStreams = &a_config.DataStreams{} - } - logger.Debug().Msgf("Using %s env var to override Automation.DataStreams.URL", E2E_TEST_DATA_STREAMS_URL_ENV) - c.Automation.DataStreams.URL = &dsURL - } - - dsUsername := ctf_config.MustReadEnvVar_String(E2E_TEST_DATA_STREAMS_USERNAME_ENV) - if dsUsername != "" { - if c.Automation == nil { - c.Automation = &a_config.Config{} - } - if c.Automation.DataStreams == nil { - c.Automation.DataStreams = &a_config.DataStreams{} - } - logger.Debug().Msgf("Using %s env var to override Automation.DataStreams.Username", E2E_TEST_DATA_STREAMS_USERNAME_ENV) - c.Automation.DataStreams.Username = &dsUsername - } - - dsPassword := ctf_config.MustReadEnvVar_String(E2E_TEST_DATA_STREAMS_PASSWORD_ENV) - if dsPassword != "" { - if c.Automation == nil { - c.Automation = &a_config.Config{} - } - if c.Automation.DataStreams == nil { - c.Automation.DataStreams = &a_config.DataStreams{} - } - logger.Debug().Msgf("Using %s env var to override Automation.DataStreams.Password", E2E_TEST_DATA_STREAMS_PASSWORD_ENV) - c.Automation.DataStreams.Password = &dsPassword - } - return nil } @@ -677,60 +451,6 @@ func (c *TestConfig) Validate() error { } } - if c.Automation != nil { - if err := c.Automation.Validate(); err != nil { - return errors.Wrapf(err, "Automation config validation failed") - } - } - - if c.Functions != nil { - if err := c.Functions.Validate(); err != nil { - return errors.Wrapf(err, "Functions config validation failed") - } - } - - if c.Keeper != nil { - if err := c.Keeper.Validate(); err != nil { - return errors.Wrapf(err, "Keeper config validation failed") - } - } - - if c.LogPoller != nil { - if err := c.LogPoller.Validate(); err != nil { - return errors.Wrapf(err, "LogPoller config validation failed") - } - } - - if c.OCR != nil { - if err := c.OCR.Validate(); err != nil { - return errors.Wrapf(err, "OCR config validation failed") - } - } - - if c.OCR2 != nil { - if err := c.OCR2.Validate(); err != nil { - return errors.Wrapf(err, "OCR2 config validation failed") - } - } - - if c.VRF != nil { - if err := c.VRF.Validate(); err != nil { - return errors.Wrapf(err, "VRF config validation failed") - } - } - - if c.VRFv2 != nil { - if err := c.VRFv2.Validate(); err != nil { - return errors.Wrapf(err, "VRFv2 config validation failed") - } - } - - if c.VRFv2Plus != nil { - if err := c.VRFv2Plus.Validate(); err != nil { - return errors.Wrapf(err, "VRFv2Plus config validation failed") - } - } - if c.WaspConfig != nil { if err := c.WaspConfig.Validate(); err != nil { return errors.Wrapf(err, "WaspAutoBuildConfig validation failed") diff --git a/integration-tests/testconfig/testconfig_test.go b/integration-tests/testconfig/testconfig_test.go deleted file mode 100644 index 8694daf1357..00000000000 --- a/integration-tests/testconfig/testconfig_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package testconfig - -import ( - "encoding/base64" - "math/big" - "os" - "testing" - - "github.com/pelletier/go-toml/v2" - "github.com/stretchr/testify/require" - - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/ptr" - a_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/automation" -) - -func TestBase64ConfigRead(t *testing.T) { - os.Setenv("E2E_TEST_ARBITRUM_GOERLI_RPC_HTTP_URL", "https://devnet-1.mt/ABC/rpc/") - os.Setenv("E2E_TEST_ARBITRUM_GOERLI_RPC_WS_URL", "wss://devnet-1.mt/ABC/rpc/") - os.Setenv("E2E_TEST_ARBITRUM_GOERLI_WALLET_KEY", "0x3333333333333333333333333333333333333333") - defer os.Unsetenv("E2E_TEST_ARBITRUM_GOERLI_RPC_HTTP_URL") - defer os.Unsetenv("E2E_TEST_ARBITRUM_GOERLI_RPC_WS_URL") - defer os.Unsetenv("E2E_TEST_ARBITRUM_GOERLI_WALLET_KEY") - os.Setenv("E2E_TEST_OPTIMISM_GOERLI_RPC_HTTP_URL", "https://devnet-3.mt/ABC/rpc/") - os.Setenv("E2E_TEST_OPTIMISM_GOERLI_RPC_WS_URL", "wss://devnet-3.mt/ABC/rpc/") - os.Setenv("E2E_TEST_OPTIMISM_GOERLI_WALLET_KEY", "0x3333333333333333333333333333333333333333") - defer os.Unsetenv("E2E_TEST_OPTIMISM_GOERLI_RPC_HTTP_URL") - defer os.Unsetenv("E2E_TEST_OPTIMISM_GOERLI_RPC_WS_URL") - defer os.Unsetenv("E2E_TEST_OPTIMISM_GOERLI_WALLET_KEY") - - testConfig := TestConfig{ - Automation: &a_config.Config{ - General: &a_config.General{ - NumberOfNodes: ptr.Ptr(7), - Duration: ptr.Ptr(9), - BlockTime: ptr.Ptr(10), - SpecType: ptr.Ptr("minimum"), - ChainlinkNodeLogLevel: ptr.Ptr("debug"), - UsePrometheus: ptr.Ptr(true), - RemoveNamespace: ptr.Ptr(true), - }, - Load: []a_config.Load{ - { - NumberOfUpkeeps: ptr.Ptr(1), - NumberOfEvents: ptr.Ptr(2), - NumberOfSpamMatchingEvents: ptr.Ptr(3), - NumberOfSpamNonMatchingEvents: ptr.Ptr(4), - CheckBurnAmount: big.NewInt(5), - PerformBurnAmount: big.NewInt(6), - SharedTrigger: ptr.Ptr(true), - }, - { - NumberOfUpkeeps: ptr.Ptr(3), - NumberOfEvents: ptr.Ptr(2), - NumberOfSpamMatchingEvents: ptr.Ptr(3), - NumberOfSpamNonMatchingEvents: ptr.Ptr(7), - CheckBurnAmount: big.NewInt(5), - PerformBurnAmount: big.NewInt(6), - SharedTrigger: ptr.Ptr(false), - }, - }, - }, - TestConfig: ctf_config.TestConfig{ - Network: &ctf_config.NetworkConfig{ - SelectedNetworks: []string{"OPTIMISM_GOERLI"}, - RpcHttpUrls: map[string][]string{ - "OPTIMISM_GOERLI": {"http://localhost:8545"}, - }, - WalletKeys: map[string][]string{ - "OPTIMISM_GOERLI": {"0x3333333333333333333333333333333333333333"}, - }, - }, - }, - } - - configMarshalled, err := toml.Marshal(testConfig) - require.NoError(t, err, "Error marshalling test config") - - testConfigEncoded := base64.StdEncoding.EncodeToString(configMarshalled) - os.Setenv(Base64OverrideEnvVarName, testConfigEncoded) - - readConfig, err := GetConfig([]string{"test"}, Automation) - require.NoError(t, err, "Error reading config") - - require.NotNil(t, readConfig.Automation, "Automation config read from base64 is nil") - require.Equal(t, testConfig.Automation.General, readConfig.Automation.General, "General automation config does not match expected") - require.Equal(t, testConfig.Automation.Load, readConfig.Automation.Load, "Load automation config does not match expected") - require.NotNil(t, readConfig.Network, "Network config read from base64 is nil") - require.Equal(t, testConfig.Network.SelectedNetworks, readConfig.Network.SelectedNetworks, "SelectedNetwork config entry read from base64 does not match expected") - require.Equal(t, []string{"http://localhost:8545"}, readConfig.Network.RpcHttpUrls["OPTIMISM_GOERLI"], "RpcHttpUrls config entry read from base64 does not match expected") - require.Equal(t, []string{"wss://devnet-2.mt/ABC/rpc/"}, readConfig.Network.RpcWsUrls["OPTIMISM_GOERLI"], "RpcWsUrls config entry read from base64 network defaults does not match expected") - require.Equal(t, testConfig.Network.WalletKeys, readConfig.Network.WalletKeys, "WalletKeys config entry read from base64 does not match expected") -} diff --git a/integration-tests/testconfig/vrf/config.go b/integration-tests/testconfig/vrf/config.go deleted file mode 100644 index d009f5bf667..00000000000 --- a/integration-tests/testconfig/vrf/config.go +++ /dev/null @@ -1,8 +0,0 @@ -package vrf - -type Config struct { -} - -func (o *Config) Validate() error { - return nil -} diff --git a/integration-tests/testconfig/vrf/vrf.toml b/integration-tests/testconfig/vrf/vrf.toml deleted file mode 100644 index a8b5f19f6b1..00000000000 --- a/integration-tests/testconfig/vrf/vrf.toml +++ /dev/null @@ -1,40 +0,0 @@ -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" \ No newline at end of file diff --git a/integration-tests/testconfig/vrfv2/config.go b/integration-tests/testconfig/vrfv2/config.go deleted file mode 100644 index 5e940403961..00000000000 --- a/integration-tests/testconfig/vrfv2/config.go +++ /dev/null @@ -1,113 +0,0 @@ -package testconfig - -import ( - "errors" - - vrf_common_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/common/vrf" -) - -type Config struct { - General *General `toml:"General"` - ExistingEnvConfig *ExistingEnvConfig `toml:"ExistingEnv"` - Performance *vrf_common_config.PerformanceConfig `toml:"Performance"` -} - -func (c *Config) Validate() error { - if c.General != nil { - if err := c.General.Validate(); err != nil { - return err - } - } - if c.Performance != nil { - if err := c.Performance.Validate(); err != nil { - return err - } - } - if c.ExistingEnvConfig != nil && *c.General.UseExistingEnv { - if err := c.ExistingEnvConfig.Validate(); err != nil { - return err - } - } - return nil -} - -type ExistingEnvConfig struct { - *vrf_common_config.ExistingEnvConfig - SubID *uint64 `toml:"sub_id"` -} - -func (c *ExistingEnvConfig) Validate() error { - if c.ExistingEnvConfig != nil { - if err := c.ExistingEnvConfig.Validate(); err != nil { - return err - } - } - if !*c.CreateFundSubsAndAddConsumers { - if c.SubID == nil { - return errors.New("sub_id must be set when using existing environment") - } - - if *c.SubID == 0 { - return errors.New("sub_id must be positive value") - } - } - - return c.Funding.Validate() -} - -type General struct { - *vrf_common_config.General - FulfillmentFlatFeeLinkPPMTier1 *uint32 `toml:"fulfilment_flat_fee_link_ppm_tier_1"` - FulfillmentFlatFeeLinkPPMTier2 *uint32 `toml:"fulfilment_flat_fee_link_ppm_tier_2"` - FulfillmentFlatFeeLinkPPMTier3 *uint32 `toml:"fulfilment_flat_fee_link_ppm_tier_3"` - FulfillmentFlatFeeLinkPPMTier4 *uint32 `toml:"fulfilment_flat_fee_link_ppm_tier_4"` - FulfillmentFlatFeeLinkPPMTier5 *uint32 `toml:"fulfilment_flat_fee_link_ppm_tier_5"` - ReqsForTier2 *int64 `toml:"reqs_for_tier_2"` - ReqsForTier3 *int64 `toml:"reqs_for_tier_3"` - ReqsForTier4 *int64 `toml:"reqs_for_tier_4"` - ReqsForTier5 *int64 `toml:"reqs_for_tier_5"` - CoordinatorGasOverhead *uint32 `toml:"coordinator_gas_overhead"` - WrapperPremiumPercentage *uint8 `toml:"wrapper_premium_percentage"` -} - -func (c *General) Validate() error { - if c.General != nil { - if err := c.General.Validate(); err != nil { - return err - } - } - if c.FulfillmentFlatFeeLinkPPMTier1 == nil || *c.FulfillmentFlatFeeLinkPPMTier1 == 0 { - return errors.New("fulfilment_flat_fee_link_ppm_tier_1 must be set to a positive value") - } - if c.FulfillmentFlatFeeLinkPPMTier2 == nil || *c.FulfillmentFlatFeeLinkPPMTier2 == 0 { - return errors.New("fulfilment_flat_fee_link_ppm_tier_2 must be set to a positive value") - } - if c.FulfillmentFlatFeeLinkPPMTier3 == nil || *c.FulfillmentFlatFeeLinkPPMTier3 == 0 { - return errors.New("fulfilment_flat_fee_link_ppm_tier_3 must be set to a positive value") - } - if c.FulfillmentFlatFeeLinkPPMTier4 == nil || *c.FulfillmentFlatFeeLinkPPMTier4 == 0 { - return errors.New("fulfilment_flat_fee_link_ppm_tier_4 must be set to a positive value") - } - if c.FulfillmentFlatFeeLinkPPMTier5 == nil || *c.FulfillmentFlatFeeLinkPPMTier5 == 0 { - return errors.New("fulfilment_flat_fee_link_ppm_tier_5 must be set to a positive value") - } - if c.ReqsForTier2 == nil || *c.ReqsForTier2 < 0 { - return errors.New("reqs_for_tier_2 must be set to a non-negative value") - } - if c.ReqsForTier3 == nil || *c.ReqsForTier3 < 0 { - return errors.New("reqs_for_tier_3 must be set to a non-negative value") - } - if c.ReqsForTier4 == nil || *c.ReqsForTier4 < 0 { - return errors.New("reqs_for_tier_4 must be set to a non-negative value") - } - if c.ReqsForTier5 == nil || *c.ReqsForTier5 < 0 { - return errors.New("reqs_for_tier_5 must be set to a non-negative value") - } - if c.CoordinatorGasOverhead == nil || *c.CoordinatorGasOverhead == 0 { - return errors.New("coordinator_gas_overhead must be set to a non-negative value") - } - if c.WrapperPremiumPercentage == nil || *c.WrapperPremiumPercentage == 0 { - return errors.New("wrapper_premium_percentage must be set to a positive value") - } - return nil -} diff --git a/integration-tests/testconfig/vrfv2/example.toml b/integration-tests/testconfig/vrfv2/example.toml deleted file mode 100644 index 3665c2f43cf..00000000000 --- a/integration-tests/testconfig/vrfv2/example.toml +++ /dev/null @@ -1,170 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Product part -[VRFv2] -[VRFv2.General] -cancel_subs_after_test_run = true -max_gas_price_gwei = 1000 -link_native_feed_response = 1000000000000000000 -minimum_confirmations = 3 -subscription_funding_amount_link = 5.0 -number_of_words = 3 -callback_gas_limit = 1000000 -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "60000000000000000" -staleness_seconds = 86400 -gas_after_payment_calculation = 33825 -fulfilment_flat_fee_link_ppm_tier_1 = 500 -fulfilment_flat_fee_link_ppm_tier_2 = 500 -fulfilment_flat_fee_link_ppm_tier_3 = 500 -fulfilment_flat_fee_link_ppm_tier_4 = 500 -fulfilment_flat_fee_link_ppm_tier_5 = 500 -reqs_for_tier_2 = 0 -reqs_for_tier_3 = 0 -reqs_for_tier_4 = 0 -reqs_for_tier_5 = 0 -number_of_sub_to_create = 1 -randomness_request_count_per_request = 1 -randomness_request_count_per_request_deviation = 0 -random_words_fulfilled_event_timeout = "2m" -wrapped_gas_overhead = 50000 -coordinator_gas_overhead = 52000 -wrapper_premium_percentage = 25 -wrapper_max_number_of_words = 10 -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 10 - -[VRFv2.Performance] -rate_limit_unit_duration = "3s" -rps = 1 - -[VRFv2.NewEnv] -sub_funds_link = 1000 -node_sending_key_funding = 1000 - -[VRFv2.ExistingEnv] -coordinator_address = "" -consumer_address = "" -sub_id = 1 -key_hash = "" -create_fund_subs_and_add_consumers = true -link_address = "" -sub_funds_link = 10 -node_sending_key_funding_min = 1 -node_sending_keys = [ - "", - "", - "", - "", - "", - "", -] \ No newline at end of file diff --git a/integration-tests/testconfig/vrfv2/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml deleted file mode 100644 index 9181c0f51fa..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["ARBITRUM_SEPOLIA"] - -[ARBITRUM_SEPOLIA.VRFv2.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2/overrides/new_env/avalanche_fuji_new_env_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/new_env/avalanche_fuji_new_env_test_config.toml deleted file mode 100644 index cfeaa5a7975..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/new_env/avalanche_fuji_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["AVALANCHE_FUJI"] - -[AVALANCHE_FUJI.VRFv2.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2/overrides/new_env/bsc_testnet_new_env_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/new_env/bsc_testnet_new_env_test_config.toml deleted file mode 100644 index ec938767ec5..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/new_env/bsc_testnet_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["BSC_TESTNET"] - -[BSC_TESTNET.VRFv2.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2/overrides/new_env/polygon_amoy_new_env_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/new_env/polygon_amoy_new_env_test_config.toml deleted file mode 100644 index 6331647a883..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/new_env/polygon_amoy_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["POLYGON_AMOY"] - -[POLYGON_AMOY.VRFv2.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2/overrides/new_env/sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/new_env/sepolia_new_env_test_config.toml deleted file mode 100644 index 591f07e6625..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/new_env/sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[SEPOLIA.VRFv2.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2/overrides/staging/polygon_amoy_staging_test_config.toml b/integration-tests/testconfig/vrfv2/overrides/staging/polygon_amoy_staging_test_config.toml deleted file mode 100644 index acdff9ff4e1..00000000000 --- a/integration-tests/testconfig/vrfv2/overrides/staging/polygon_amoy_staging_test_config.toml +++ /dev/null @@ -1,24 +0,0 @@ -[Network] -selected_networks = ["POLYGON_AMOY"] - -[POLYGON_AMOY.VRFv2.General] -use_existing_env = true - -[POLYGON_AMOY.VRFv2.ExistingEnv] -coordinator_address = "0x919BEF67CE94604A7Cd5747F2c0088C8EB8A93aa" -consumer_address = "" -sub_id = "" -key_hash = "0xcd9c54d52db91522b69fe8ddc40d1f78156795de0efb2adbc053a438b9ee14a6" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 10 -node_sending_keys = [ - "0xD4B787C4ce6E04c16b5FDce2c25956b8F4432195", - # BHS - "0x638372de870eF0F8E675A3f67F18D5bd4A2fd804", - "0xF9eF03816411D037202d5ed4457dC1613e3bd729", - "0xCD66973f8fbaE787211EC20228c6bd90D83562A8", - "0x242ea1F4Bb72EF643B2D8EF22e18a89f00742F40", - "0xaA09B4F9B5710b239fdbf1D0f535dd7f86F91219", - "0xe6b72B647B8B45C5562F7a5259E187889C747d3b", - "0x2c1185C4d3B0B4a577d4079Ee193A4e293164D9d" -] diff --git a/integration-tests/testconfig/vrfv2/vrfv2.toml b/integration-tests/testconfig/vrfv2/vrfv2.toml deleted file mode 100644 index 634e3074feb..00000000000 --- a/integration-tests/testconfig/vrfv2/vrfv2.toml +++ /dev/null @@ -1,206 +0,0 @@ -# default config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -LogPoller = true - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -HTTPWriteTimeout = '1m0s' -SecureCookies = false - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 100 - -[WebServer.TLS] -HTTPSPort = 0 -""" - -[NodeConfig.ChainConfigTOMLByChainID] -# OPTIMISM SEPOLIA -11155420 = """ -BlockBackfillDepth = 500 -LogBackfillBatchSize = 1000 -RPCDefaultBatchSize = 25 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - - - -[Common] -chainlink_node_funding = 0.5 - -[VRFv2] -[VRFv2.General] -cancel_subs_after_test_run = true -use_existing_env = false -subscription_funding_amount_link = 5.0 -subscription_refunding_amount_link = 5.0 - -cl_node_max_gas_price_gwei = 10 -link_native_feed_response = 1000000000000000000 -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 3 -generate_txs_on_chain = false - -number_of_words = 3 -callback_gas_limit = 1000000 -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "60000000000000000" -staleness_seconds = 86400 -gas_after_payment_calculation = 33825 -fulfilment_flat_fee_link_ppm_tier_1 = 500 -fulfilment_flat_fee_link_ppm_tier_2 = 500 -fulfilment_flat_fee_link_ppm_tier_3 = 500 -fulfilment_flat_fee_link_ppm_tier_4 = 500 -fulfilment_flat_fee_link_ppm_tier_5 = 500 -reqs_for_tier_2 = 0 -reqs_for_tier_3 = 0 -reqs_for_tier_4 = 0 -reqs_for_tier_5 = 0 -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -randomness_request_count_per_request = 1 -randomness_request_count_per_request_deviation = 0 -random_words_fulfilled_event_timeout = "2m" -wait_for_256_blocks_timeout = "280s" -wrapped_gas_overhead = 50000 -coordinator_gas_overhead = 52000 -wrapper_premium_percentage = 25 -wrapper_max_number_of_words = 10 -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.1 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.15 -vrf_job_poll_period = "1s" -vrf_job_request_timeout = "24h" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 250 -bhs_job_poll_period = "1s" -bhs_job_run_timeout = "24h" - -# BHF Job config -bhf_job_wait_blocks = 260 -bhf_job_lookback_blocks = 500 -bhf_job_poll_period = "30s" -bhf_job_run_timeout = "1h" - -# PERFORMANCE test specific config - -[VRFv2.ExistingEnv] -coordinator_address = "" -key_hash = "" - -use_existing_wrapper = false -wrapper_address = "" -create_fund_subs_and_add_consumers = true -sub_id = 1 -consumer_address = "" - -create_fund_add_wrapper_consumers = true -wrapper_consumer_address = "" - -node_sending_key_funding_min = 10 -node_sending_keys = [ - "", - "", - "" -] - -[VRFv2.Performance] -test_duration = "10s" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "10s" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -[Smoke.VRFv2.Performance] -test_duration = "10s" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "10s" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -#SOAK TEST CONFIG -[Soak.Common] -chainlink_node_funding = 0.1 - -[Soak.VRFv2.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 5.0 - -[Soak.VRFv2.Performance] -test_duration = "1m" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -# LOAD TEST CONFIG -[Load.Common] -chainlink_node_funding = 0.1 - -[Load.VRFv2.General] -randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 5.0 - -[Load.VRFv2.Performance] -test_duration = "2m" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -# STRESS TEST CONFIG -[Stress.Common] -chainlink_node_funding = 0.1 - -[Stress.VRFv2.General] -randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 5.0 - -[Stress.VRFv2.Performance] -test_duration = "2m" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 diff --git a/integration-tests/testconfig/vrfv2plus/config.go b/integration-tests/testconfig/vrfv2plus/config.go deleted file mode 100644 index 5398d1e0386..00000000000 --- a/integration-tests/testconfig/vrfv2plus/config.go +++ /dev/null @@ -1,131 +0,0 @@ -package testconfig - -import ( - "errors" - - vrf_common_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/common/vrf" -) - -type BillingType string - -const ( - BillingType_Link BillingType = "LINK" - BillingType_Native BillingType = "NATIVE" - BillingType_Link_and_Native BillingType = "LINK_AND_NATIVE" -) - -type Config struct { - General *General `toml:"General"` - ExistingEnvConfig *ExistingEnvConfig `toml:"ExistingEnv"` - Performance *vrf_common_config.PerformanceConfig `toml:"Performance"` -} - -func (c *Config) Validate() error { - if c.General != nil { - if err := c.General.Validate(); err != nil { - return err - } - } - if c.Performance != nil { - if err := c.Performance.Validate(); err != nil { - return err - } - } - if c.ExistingEnvConfig != nil && *c.General.UseExistingEnv { - if err := c.ExistingEnvConfig.Validate(); err != nil { - return err - } - } - return nil -} - -type General struct { - *vrf_common_config.General - SubscriptionBillingType *string `toml:"subscription_billing_type"` // Billing type for the subscription - SubscriptionFundingAmountNative *float64 `toml:"subscription_funding_amount_native"` // Amount of LINK to fund the subscription with - SubscriptionRefundingAmountNative *float64 `toml:"subscription_refunding_amount_native"` // Amount of LINK to fund the subscription with - FulfillmentFlatFeeNativePPM *uint32 `toml:"fulfillment_flat_fee_native_ppm"` // Flat fee in ppm for native currency for the VRF Coordinator config - FulfillmentFlatFeeLinkDiscountPPM *uint32 `toml:"fulfillment_flat_fee_link_discount_ppm"` // Flat fee discount in ppm for LINK for the VRF Coordinator config - NativePremiumPercentage *uint8 `toml:"native_premium_percentage"` // Native Premium Percentage - LinkPremiumPercentage *uint8 `toml:"link_premium_percentage"` // LINK Premium Percentage - - // Wrapper config - CoordinatorGasOverheadPerWord *uint16 `toml:"coordinator_gas_overhead_per_word"` - CoordinatorGasOverheadNative *uint32 `toml:"coordinator_gas_overhead_native"` - CoordinatorGasOverheadLink *uint32 `toml:"coordinator_gas_overhead_link"` - CoordinatorNativePremiumPercentage *uint8 `toml:"coordinator_native_premium_percentage"` - CoordinatorLinkPremiumPercentage *uint8 `toml:"coordinator_link_premium_percentage"` - - // OP Stack chains settings - L1FeeCalculationMode *uint8 `toml:"l1_fee_calculation_mode"` - L1FeeCoefficient *uint8 `toml:"l1_fee_coefficient"` - - UseTestCoordinator *bool `toml:"use_test_coordinator"` - - SubBillingTolerance *float64 `toml:"sub_billing_tolerance_wei"` -} - -func (c *General) Validate() error { - if err := c.General.Validate(); err != nil { - return err - } - if c.SubscriptionBillingType == nil || *c.SubscriptionBillingType == "" { - return errors.New("subscription_billing_type must be set to either: LINK, NATIVE, LINK_AND_NATIVE") - } - if c.SubscriptionFundingAmountNative == nil || *c.SubscriptionFundingAmountNative <= 0 { - return errors.New("subscription_funding_amount_native must be greater than 0") - } - if c.SubscriptionRefundingAmountNative == nil || *c.SubscriptionRefundingAmountNative <= 0 { - return errors.New("subscription_refunding_amount_native must be greater than 0") - } - if c.FulfillmentFlatFeeNativePPM == nil { - return errors.New("fulfillment_flat_fee_native_ppm must not be nil") - } - if c.FulfillmentFlatFeeLinkDiscountPPM == nil { - return errors.New("fulfillment_flat_fee_link_discount_ppm must not be nil") - } - if c.NativePremiumPercentage == nil { - return errors.New("native_premium_percentage must not be nil") - } - if c.LinkPremiumPercentage == nil { - return errors.New("link_premium_percentage must not be nil") - } - if c.CoordinatorGasOverheadPerWord == nil { - return errors.New("coordinator_gas_overhead_per_word must not be nil") - } - if c.CoordinatorGasOverheadNative == nil || *c.CoordinatorGasOverheadNative == 0 { - return errors.New("coordinator_gas_overhead_native must be set to a non-negative value") - } - if c.CoordinatorGasOverheadLink == nil || *c.CoordinatorGasOverheadLink == 0 { - return errors.New("coordinator_gas_overhead_link must be set to a non-negative value") - } - if c.CoordinatorNativePremiumPercentage == nil { - return errors.New("coordinator_native_premium_percentage must not be nil") - } - if c.CoordinatorLinkPremiumPercentage == nil { - return errors.New("coordinator_link_premium_percentage must not be nil") - } - if c.UseTestCoordinator == nil { - return errors.New("use_test_coordinator must not be nil") - } - return nil -} - -type ExistingEnvConfig struct { - *vrf_common_config.ExistingEnvConfig - SubID *string `toml:"sub_id"` -} - -func (c *ExistingEnvConfig) Validate() error { - if c.ExistingEnvConfig != nil { - if err := c.ExistingEnvConfig.Validate(); err != nil { - return err - } - } - if !*c.CreateFundSubsAndAddConsumers { - if c.SubID == nil && *c.SubID == "" { - return errors.New("sub_id must be set when using existing environment") - } - } - return c.Funding.Validate() -} diff --git a/integration-tests/testconfig/vrfv2plus/example.toml b/integration-tests/testconfig/vrfv2plus/example.toml deleted file mode 100644 index a45d53f67b8..00000000000 --- a/integration-tests/testconfig/vrfv2plus/example.toml +++ /dev/null @@ -1,182 +0,0 @@ -# Example of full config with all fields -# General part -[ChainlinkImage] -version="2.7.0" - -[Logging] -# if set to true will save logs even if test did not fail -test_log_collect=false - -# if you want to use polygon_mumbial -[Network] -selected_networks=["polygon_mumbai"] - -[PrivateEthereumNetwork] -# pos or pow -consensus_type="pos" -# only prysm supported currently -consensus_layer="prysm" -# geth, besu, nethermind or erigon -execution_layer="geth" -# if true after env started it will wait for at least 1 epoch to be finalised before continuing -wait_for_finalization=false - -[PrivateEthereumNetwork.EthereumChainConfig] -# duration of single slot, lower => faster block production, must be >= 4 -seconds_per_slot=12 -# numer of slots in epoch, lower => faster epoch finalisation, must be >= 4 -slots_per_epoch=6 -# extra genesis gelay, no need to modify, but it should be after all validators/beacon chain starts -genesis_delay=15 -# number of validators in the network -validator_count=8 -chain_id=1337 -# list of addresses to be prefunded in genesis -addresses_to_fund=["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"] - -[PrivateEthereumNetwork.EthereumChainConfig.HardForkEpochs] -# hardforks to be applied (fork_name = epoch) -Deneb=500 - -# Chainlink node TOML config -[NodeConfig] -BaseConfigTOML = """ -[Feature] -FeedsManager = true -LogPoller = true -UICSAKeys = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -SecureCookies = false -HTTPWriteTimeout = '3m' -SessionTimeout = '999h0m0s' - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 1000 - -[WebServer.TLS] -HTTPSPort = 0 - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[OCR] -Enabled = true - -[P2P] -[P2P.V2] -ListenAddresses = ['0.0.0.0:6690'] -""" - -# override config toml related to EVMNode configs for chainlink nodes; applicable to all EVM node configs in chainlink toml -CommonChainConfigTOML = """ -AutoCreateKey = true -FinalityDepth = 1 -MinContractPayment = 0 - -[GasEstimator] -PriceMax = '200 gwei' -LimitDefault = 6000000 -FeeCapDefault = '200 gwei' -""" - -# chainlink override config toml for EVMNode config specific to EVM chains with chain id as mentioned in the key -[NodeConfig.ChainConfigTOMLByChainID] -# applicable for arbitrum-goerli chain -421613 = """ -[GasEstimator] -PriceMax = '400 gwei' -LimitDefault = 100000000 -FeeCapDefault = '200 gwei' -BumpThreshold = 60 -BumpPercent = 20 -BumpMin = '100 gwei' -""" - -# Common -[Common] -chainlink_node_funding = 0.5 - -# Product part -[VRFv2Plus] -[VRFv2Plus.General] -cancel_subs_after_test_run = true -max_gas_price_gwei = 1000 -link_native_feed_response = 1000000000000000000 -minimum_confirmations = 3 -subscription_billing_type = "LINK_AND_NATIVE" -subscription_funding_amount_link = 5.0 -number_of_words = 3 -callback_gas_limit = 1000000 -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "60000000000000000" -staleness_seconds = 86400 -gas_after_payment_calculation = 33825 -fulfilment_flat_fee_link_ppm_tier_1 = 500 -fulfilment_flat_fee_link_ppm_tier_2 = 500 -fulfilment_flat_fee_link_ppm_tier_3 = 500 -fulfilment_flat_fee_link_ppm_tier_4 = 500 -fulfilment_flat_fee_link_ppm_tier_5 = 500 -reqs_for_tier_2 = 0 -reqs_for_tier_3 = 0 -reqs_for_tier_4 = 0 -reqs_for_tier_5 = 0 -number_of_sub_to_create = 1 -randomness_request_count_per_request = 1 -randomness_request_count_per_request_deviation = 0 -random_words_fulfilled_event_timeout = "2m" -wrapped_gas_overhead = 50000 -coordinator_gas_overhead_native = 52000 -coordinator_gas_overhead_link = 74000 -coordinator_gas_overhead_per_word = 440 -wrapper_premium_percentage = 25 -wrapper_max_number_of_words = 10 -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 10 -subscription_funding_amount_native=1 -fulfillment_flat_fee_native_ppm=500 -fulfillment_flat_fee_link_discount_ppm=100 -native_premium_percentage=1 -link_premium_percentage=1 - -[VRFv2Plus.Performance] -test_duration = "2m" -rate_limit_unit_duration = "3s" -rps = 1 -use_existing_env = false - -[VRFv2Plus.NewEnv] -sub_funds_link = 1 -sub_funds_native = 1 -node_funds = 10 -node_sending_key_funding = 1000 - -[VRFv2Plus.ExistingEnv] -coordinator_address = "" -consumer_address = "" -sub_id = 1 -key_hash = "" -create_fund_subs_and_add_consumers = true -link_address = "" -sub_funds_link = 10 -node_sending_key_funding_min = 1 -node_sending_keys = [ - "", - "", - "", - "", - "", - "", -] \ No newline at end of file diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml deleted file mode 100644 index 271ef037bd3..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/arbitrum_sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["ARBITRUM_SEPOLIA"] - -[ARBITRUM_SEPOLIA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/avalanche_fuji_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/avalanche_fuji_new_env_test_config.toml deleted file mode 100644 index 273d796ba6f..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/avalanche_fuji_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["AVALANCHE_FUJI"] - -[AVALANCHE_FUJI.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/base_sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/base_sepolia_new_env_test_config.toml deleted file mode 100644 index f93c75cc380..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/base_sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["BASE_SEPOLIA"] - -[BASE_SEPOLIA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/bsc_testnet_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/bsc_testnet_new_env_test_config.toml deleted file mode 100644 index 16cc9a6e539..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/bsc_testnet_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["BSC_TESTNET"] - -[BSC_TESTNET.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_dev_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_dev_new_env_test_config.toml deleted file mode 100644 index 5d7b7741081..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_dev_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["NEXON_DEV"] - -[NEXON_DEV.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_qa_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_qa_new_env_test_config.toml deleted file mode 100644 index 0f761128afa..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_qa_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["NEXON_QA"] - -[NEXON_QA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_stage_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_stage_new_env_test_config.toml deleted file mode 100644 index 5dcd771e9dd..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_stage_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["NEXON_STAGE"] - -[NEXON_STAGE.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_test_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_test_new_env_test_config.toml deleted file mode 100644 index d1263df34d0..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/nexon_test_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["NEXON_TEST"] - -[NEXON_TEST.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/optimism_sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/optimism_sepolia_new_env_test_config.toml deleted file mode 100644 index 8fd5b763796..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/optimism_sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["OPTIMISM_SEPOLIA"] - -[OPTIMISM_SEPOLIA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/polygon_amoy_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/polygon_amoy_new_env_test_config.toml deleted file mode 100644 index 10abe34bb5e..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/polygon_amoy_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["POLYGON_AMOY"] - -[POLYGON_AMOY.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/sepolia_new_env_test_config.toml deleted file mode 100644 index 7df808c505f..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[SEPOLIA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/new_env/soneium_sepolia_new_env_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/new_env/soneium_sepolia_new_env_test_config.toml deleted file mode 100644 index beacf9c5f7c..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/new_env/soneium_sepolia_new_env_test_config.toml +++ /dev/null @@ -1,8 +0,0 @@ -[Network] -selected_networks = ["SONEIUM_SEPOLIA"] - -[SONEIUM_SEPOLIA.VRFv2Plus.General] -use_existing_env = false - -[Logging] -test_log_collect = true diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/arbitrum_sepolia_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/arbitrum_sepolia_staging_test_config.toml deleted file mode 100644 index 66529bbed3a..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/arbitrum_sepolia_staging_test_config.toml +++ /dev/null @@ -1,36 +0,0 @@ -[Network] -selected_networks = ["ARBITRUM_SEPOLIA"] - -[ARBITRUM_SEPOLIA.VRFv2Plus.General] -use_existing_env = true - -[ARBITRUM_SEPOLIA.VRFv2Plus.ExistingEnv] -coordinator_address = "0xF7ba1Cf141F9729abC43c146dc2bf86EbcfD8603" -consumer_address = "" -sub_id = "" -key_hash = "0xe13aa26fe94bfcd2ae055911f4d3bf1aed54ca6cf77af34e17f918802fd69ba1" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 20 -node_sending_keys = [ - "0xbE21ae371FcA1aC2d8A152e707D21e68d7d99252", - "0xb13e9BA0aE94FD3b89B13b092e6d41614c805134", - "0x27aa703e585Ee165B7c977EAA652eCFa13b08294", - "0x9324643ACD2ec5b0813488E5EdAb64C3758ae4Ee", - "0x7CBA8c8e86f23f23363051650Fe5AE4DE78c3652", - "0x9A0143a4BAB55A826331A8ef82462557633aA016", - "0xD4259633F8e87949F683433a17e1fFcCE27865AC", - "0x5e47B71d6F95f68cd5538907ec6A9635b1Fe30Fa", - "0xa850a1a257FDF439c8f854ce3b89dd5b6F411827", - "0x7c82D56087c10aF2c3970f9a9Be7786B2850ce91", - "0x9545CB59956347d3debf27f5029754bBE1d398FA", - "0xEb8C69ac19709f27A97FB4A561f51AD2F9b34c5B", - # BHS - "0xf0e8cF7Fbd28Fc4D412B76B744CDA269df671F8e", - "0x317A02A658d12E5Bb4A6270171E7385928dD2d53", - "0x480f1dbcEc118Bd91e4dbb7e45bFa4A73180d21f", - "0x500a2662FaF981EC4669f791349D37Cbf1bE7d85", - "0x2ad350374B904c10B47c64ECdBD9e70BB0833Be2", - "0x0b946F0bF4e63C12b5157137f1c130f0788bC1b1", - # BHF - "0x571BBF4a5b07fc3F47Bd3B65CE2FE73739f86623" -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/avalanche_fuji_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/avalanche_fuji_staging_test_config.toml deleted file mode 100644 index c8566e59a74..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/avalanche_fuji_staging_test_config.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["AVALANCHE_FUJI"] - -[AVALANCHE_FUJI.VRFv2Plus.General] -use_existing_env = true - -[AVALANCHE_FUJI.VRFv2Plus.ExistingEnv] -coordinator_address = "0xE122bf3Badd6545bDec5D4627a6DAd16352A1b36" -consumer_address = "" -sub_id = "" -key_hash = "0x5b03254a80ea3eb72139ff0423cb88be42612780c3dd25f1d95a5ba7708a4be1" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0x3D7Da5D6A23CA2240CE576C8638C1798a023920a", - # BHS - "0x72c8565279430F5179b0090d51ab8BB53Da323B5" -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/base_sepolia_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/base_sepolia_staging_test_config.toml deleted file mode 100644 index ad125ae46b4..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/base_sepolia_staging_test_config.toml +++ /dev/null @@ -1,20 +0,0 @@ -[Network] -selected_networks = ["BASE_SEPOLIA"] - -[BASE_SEPOLIA.VRFv2Plus.General] -use_existing_env = true - -[BASE_SEPOLIA.VRFv2Plus.ExistingEnv] -coordinator_address = "0x2Cf7Bb5923FA4dBdf92981fDBbEe27d13A896705" -consumer_address = "" -sub_id = "" -key_hash = "0x01d1eb450e0271ac86d3b78c7cc799f80e7f80863a4875f6fc7b66629419c951" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0x5d621FF993B1a990d189936E70021c585e3B0880", - "0x87F701AD21BfAF99eF64596c5CE8762a5Cb9ED13", - "0xe8B0865e9Aae9DE628BE14965Bbd1C0c9C80d245", - # BHS - "0x65C853683beB6363869DDda8534b2aD45786d380", -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/bsc_testnet_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/bsc_testnet_staging_test_config.toml deleted file mode 100644 index 48060a88cf9..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/bsc_testnet_staging_test_config.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["BSC_TESTNET"] - -[BSC_TESTNET.VRFv2Plus.General] -use_existing_env = true - -[BSC_TESTNET.VRFv2Plus.ExistingEnv] -coordinator_address = "0x84A477F6ebF33501eE3ACA86fEcB980b1fC99AC2" -consumer_address = "" -sub_id = "" -key_hash = "0x4d43763d3eff849a89cf578a42787baa32132d7a80032125710e95b3972cd214" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0x4EE2Cc6D50E8acb6BaEf673B03559525a6c92fB8", - # BHS - "0xAFB44568f7DAc218EA6e1C71c366692ED4758A07" -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_dev_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_dev_staging_test_config.toml deleted file mode 100644 index 0121c025526..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_dev_staging_test_config.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["NEXON_DEV"] - -[NEXON_DEV.VRFv2Plus.General] -use_existing_env = true - -[NEXON_DEV.VRFv2Plus.ExistingEnv] -coordinator_address = "0x6901d7236A823E7B7911d90FBe46E6FA770CC823" -consumer_address = "" -sub_id = "" -key_hash = "0xdc023892a41e5fe74ec7c4c2e8c0a808b01aea7acaf2b2ae30f4e08df877c48b" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0xF3d9879a75BBD85890056D7c6cB37C555F9b41A3", - # BHS - "0xb544f9D7c16a30af0EEd0afcC4132D1c63bAF8AC", -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_qa_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_qa_staging_test_config.toml deleted file mode 100644 index f45ecde0ed5..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_qa_staging_test_config.toml +++ /dev/null @@ -1,20 +0,0 @@ -[Network] -selected_networks = ["NEXON_QA"] - -[NEXON_QA.VRFv2Plus.General] -use_existing_env = true - -[NEXON_QA.VRFv2Plus.ExistingEnv] -coordinator_address = "0xF1F0beBcc284591FCD28d8f2BAc9f30efdA3E0ea" -consumer_address = "" -sub_id = "" -key_hash = "0x7d5692e71807c4c02f5a109627a9ad2b12a361a346790a306983af9a5e3a186f" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0xB97c0C52A2B957b45DA213e652c76090DDd0FEc6", - "0xe205F5d4a99ca0f474d0b4d12f60a0153c786B4E", - # BHS - "0xf85E291edF0352435f2fD5e817030f6542375a99", -] - diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_stage_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_stage_staging_test_config.toml deleted file mode 100644 index 1a50876a730..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_stage_staging_test_config.toml +++ /dev/null @@ -1,15 +0,0 @@ -[Network] -selected_networks = ["NEXON_STAGE"] - -[NEXON_STAGE.VRFv2Plus.General] -use_existing_env = true - -[NEXON_STAGE.VRFv2Plus.ExistingEnv] -coordinator_address = "0xF705dD3e7E717F32de0Cc5F833f8009f16122AD1" -consumer_address = "" -sub_id = "" -key_hash = "0xbc9f525e3e1d9e2336f7c77d5f33f5b60aab3765944617fed7f66a6afecac616" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_test_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_test_staging_test_config.toml deleted file mode 100644 index 4f897f4e1d0..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/nexon_test_staging_test_config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[Network] -selected_networks = ["NEXON_TEST"] - -[NEXON_TEST.VRFv2Plus.General] -use_existing_env = true - -[NEXON_TEST.VRFv2Plus.ExistingEnv] -coordinator_address = "0xAa92Ba21168B48195cAdB87cfaB3eB70B2499F55" -consumer_address = "" -sub_id = "" -key_hash = "0x0cb2a18e8b762cb4c8f7b17a6cc02ac7b9d2a3346f048cfd2f5d37677f8747d8" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0xBFD780Af421e98C35918e10B9d6da7389C3e1D10", - "0xbf6c76024672F233aB8164EC00683e1AE774F6b0", - # BHS - "0x2a3900Ac77de110670E060DBFf4fCbe36c6f8170", -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/optimism_sepolia_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/optimism_sepolia_staging_test_config.toml deleted file mode 100644 index e44085067cf..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/optimism_sepolia_staging_test_config.toml +++ /dev/null @@ -1,20 +0,0 @@ -[Network] -selected_networks = ["OPTIMISM_SEPOLIA"] - -[OPTIMISM_SEPOLIA.VRFv2Plus.General] -use_existing_env = true - -[OPTIMISM_SEPOLIA.VRFv2Plus.ExistingEnv] -coordinator_address = "0xA4a64A217bE85680e0ebB454CD5BF4A1c274Fc7B" -consumer_address = "" -sub_id = "" -key_hash = "0x4b4838bbf22a7c5a871ada8ceab6ded3c2de6cadc037371146ee70f6435325c1" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0x17509D615052DE3A81a684755Ec118d62C4e1Cd1", - "0x5118ece61294f4dFf4a1fb63b3f036969516dF0a", - "0x89554391652616ea06a408263b9B2b9a70E87204", - # BHS - "0x8DE6446b5022C68F38CD32d04AA0E3b8F4C1aaB6", -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/polygon_amoy_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/polygon_amoy_staging_test_config.toml deleted file mode 100644 index d2f9727483e..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/polygon_amoy_staging_test_config.toml +++ /dev/null @@ -1,32 +0,0 @@ -[Network] -selected_networks = ["POLYGON_AMOY"] - -[POLYGON_AMOY.VRFv2Plus.General] -use_existing_env = true - -[POLYGON_AMOY.VRFv2Plus.ExistingEnv] -coordinator_address = "0x7541EbaE23f32B4A1A2e7a8Cbf9da9582767A9B4" -consumer_address = "" -sub_id = "" -key_hash = "0xd360445bacd26df47086ccf255c4f932d297ed8d5c7334b51eed32f61c541601" -#key_hash = "0x2328cbee29e32d0b6662d6df82ff0fea7be300bd310561c92f515c9ee19464f1" -#key_hash = "0x25f4e2d0509f42ec77db5380f3433a89fe623fa75f65d5b398d5f498327be4dd" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 10 -node_sending_keys = [ - "0xD96013C241f1741C35a135321969f92Aae02A12F", - "0x0580E61a5523F5CAAC4968E4f8FE63b59596BdD7", - "0xd15FcEa6a6AA17085930Fbd5647A9F7fD2Ff58b8", - "0xB7277cBb6E7028AE65235b8ee9201AcBb14B11d4", - "0x6D36a1dC1eEd25C75961E989c4d01Cd4453bE465", - "0xd299Cd7C0073b71e620bf8A3bfD50F75c0b49af8", - "0x48BE7BAED0b65776D85DF971fA901c637cFC5e87", - # BHS - "0x638372de870eF0F8E675A3f67F18D5bd4A2fd804", - "0xF9eF03816411D037202d5ed4457dC1613e3bd729", - "0xCD66973f8fbaE787211EC20228c6bd90D83562A8", - "0x242ea1F4Bb72EF643B2D8EF22e18a89f00742F40", - "0xaA09B4F9B5710b239fdbf1D0f535dd7f86F91219", - "0xe6b72B647B8B45C5562F7a5259E187889C747d3b", - "0x2c1185C4d3B0B4a577d4079Ee193A4e293164D9d" -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/sepolia_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/sepolia_staging_test_config.toml deleted file mode 100644 index fd2e6f0bc1d..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/sepolia_staging_test_config.toml +++ /dev/null @@ -1,18 +0,0 @@ -[Network] -selected_networks = ["SEPOLIA"] - -[SEPOLIA.VRFv2Plus.General] -use_existing_env = true - -[SEPOLIA.VRFv2Plus.ExistingEnv] -coordinator_address = "0x2F3b892710523Ee9A85c3155a42089fFe99Ca31e" -consumer_address = "" -sub_id = "" -key_hash = "0xf5b4a359df0598eef89872ea2170f2afa844dbf74b417e6d44d4bda9420aceb2" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 30 -node_sending_keys = [ - "0x0c0DC7f33A1256f0247c5ea75861d385fa5FED31", - # BHS - "0xEd8A4b792d16484f6c9B4df1e721e8280925Db80", -] diff --git a/integration-tests/testconfig/vrfv2plus/overrides/staging/soneium_sepolia_staging_test_config.toml b/integration-tests/testconfig/vrfv2plus/overrides/staging/soneium_sepolia_staging_test_config.toml deleted file mode 100644 index df973d87022..00000000000 --- a/integration-tests/testconfig/vrfv2plus/overrides/staging/soneium_sepolia_staging_test_config.toml +++ /dev/null @@ -1,20 +0,0 @@ -[Network] -selected_networks = ["SONEIUM_SEPOLIA"] - -[SONEIUM_SEPOLIA.VRFv2Plus.General] -use_existing_env = true - -[SONEIUM_SEPOLIA.VRFv2Plus.ExistingEnv] -coordinator_address = "0x81e211D679231615C2601E82B658Bde449AF240f" -consumer_address = "" -use_existing_wrapper = true -wrapper_address = "0xD06CfcDAa6f32BB131e693F99f502ac31588CBC8" -sub_id = "" -key_hash = "0x9552c9542c079db4f8c6867e27f6c4780e3e24d895cb0890ca9984764dbe7200" -create_fund_subs_and_add_consumers = true -node_sending_key_funding_min = 1 -node_sending_keys = [ - "0x22643FcF2018ac636477CFE19Ed17071FF7A5cA0", - # BHS - "0xD012B272E8ec6eA7A3373E340Ead52FA2C7352ea", -] diff --git a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml b/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml deleted file mode 100644 index c9f5ac12a81..00000000000 --- a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml +++ /dev/null @@ -1,1313 +0,0 @@ -# default config - -[NodeConfig] -BaseConfigTOML = """ -[Feature] -LogPoller = true - -[Database] -MaxIdleConns = 20 -MaxOpenConns = 40 -MigrateOnStartup = true - -[Log] -Level = 'debug' -JSONConsole = true - -[Log.File] -MaxSize = '0b' - -[WebServer] -AllowOrigins = '*' -HTTPPort = 6688 -HTTPWriteTimeout = '1m0s' -SecureCookies = false - -[WebServer.RateLimit] -Authenticated = 2000 -Unauthenticated = 100 - -[WebServer.TLS] -HTTPSPort = 0 -""" - -# Node TOML config depending on the chain -[NodeConfig.ChainConfigTOMLByChainID] -# ETHEREUM SEPOLIA -11155111 = """ -BlockBackfillDepth = 500 -MinIncomingConfirmations = 3 - -[GasEstimator] -LimitDefault = 3500000 -""" - -# BNB TESTNET -97 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Polygon Amoy -80002 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 - -[Transactions] -MaxInFlight = 128 -MaxQueued = 0 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Avalanche Fuji -43113 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Arbitrum Sepolia -# NOTE: PROD env has `LimitDefault = 100_000_000`, but it is decreased in order not to over spend testnet tokens -421614 = """ -BlockBackfillDepth = 15000 -LogBackfillBatchSize = 1000 -RPCDefaultBatchSize = 25 - -[Transactions] -MaxInFlight = 128 -MaxQueued = 0 - -[GasEstimator] -LimitDefault = 3_500_000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# OPTIMISM SEPOLIA -11155420 = """ -BlockBackfillDepth = 500 -LogBackfillBatchSize = 1000 -RPCDefaultBatchSize = 25 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# BASE SEPOLIA -84532 = """ -BlockBackfillDepth = 500 -LogBackfillBatchSize = 1000 -RPCDefaultBatchSize = 25 - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" -# Nexon Staging -847799 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 -NoNewHeadsThreshold = '0s' - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Nexon QA -807424 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 -NoNewHeadsThreshold = '0s' - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Nexon TEST -595581 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 -NoNewHeadsThreshold = '0s' - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - -# Nexon DEV -5668 = """ -BlockBackfillDepth = 500 -RPCDefaultBatchSize = 25 -LogBackfillBatchSize = 1000 -NoNewHeadsThreshold = '0s' - -[GasEstimator] -LimitDefault = 3500000 - -[GasEstimator.BlockHistory] -BatchSize = 100 -""" - - -[Common] -chainlink_node_funding = 0.7 - -[VRFv2Plus] -[VRFv2Plus.General] -sub_billing_tolerance_wei = 1e15 -use_test_coordinator = false -cancel_subs_after_test_run = true -use_existing_env = false -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 3 -# Can be "LINK", "NATIVE" or "LINK_AND_NATIVE" -subscription_billing_type = "LINK_AND_NATIVE" -generate_txs_on_chain = false - -#CL Node config -cl_node_max_gas_price_gwei = 10 -number_of_sending_keys_to_create = 0 - -# Randomness Request Config -number_of_sub_to_create = 1 -number_of_words = 3 -callback_gas_limit = 1000000 -subscription_funding_amount_link = 5.0 -subscription_funding_amount_native=1 -subscription_refunding_amount_link = 5.0 -subscription_refunding_amount_native = 1 -randomness_request_count_per_request = 1 -randomness_request_count_per_request_deviation = 0 -random_words_fulfilled_event_timeout = "2m" -wait_for_256_blocks_timeout = "280s" - -# Coordinator config -link_native_feed_response = 1000000000000000000 -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "60000000000000000" -staleness_seconds = 86400 -gas_after_payment_calculation = 33825 -fulfillment_flat_fee_native_ppm=0 -fulfillment_flat_fee_link_discount_ppm=0 -native_premium_percentage=24 -link_premium_percentage=20 - -# 0 = L1_GAS_FEES_MODE; 1 = L1_CALLDATA_GAS_COST_MODE; 2 = L1_GAS_FEES_UPPER_BOUND_MODE -l1_fee_calculation_mode = 2 -l1_fee_coefficient = 80 - -# Wrapper config -wrapped_gas_overhead = 50000 -coordinator_gas_overhead_native = 52000 -coordinator_gas_overhead_link = 74000 -coordinator_gas_overhead_per_word = 440 -wrapper_max_number_of_words = 10 -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 10 -coordinator_native_premium_percentage=24 -coordinator_link_premium_percentage=20 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.1 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.15 -vrf_job_poll_period = "1s" -vrf_job_request_timeout = "24h" -# should be "latest" if minimum_confirmations>0, "pending" if minimum_confirmations=0 -vrf_job_simulation_block="latest" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 250 -bhs_job_poll_period = "1s" -bhs_job_run_timeout = "24h" - -# BHF Job config -bhf_job_wait_blocks = 260 -bhf_job_lookback_blocks = 500 -bhf_job_poll_period = "30s" -bhf_job_run_timeout = "1h" - -# PERFORMANCE test specific config - -[VRFv2Plus.ExistingEnv] -coordinator_address = "" -key_hash = "" - -use_existing_wrapper = false -wrapper_address = "" -create_fund_subs_and_add_consumers = true -sub_id = "" -consumer_address = "" - -create_fund_add_wrapper_consumers = true -wrapper_consumer_address = "" - -node_sending_key_funding_min = 1 -node_sending_keys = [] - -[VRFv2Plus.Performance] -test_duration = "10s" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "10s" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -#SOAK TEST CONFIG - -[Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -# LOAD TEST CONFIG -[Load.Common] -chainlink_node_funding = 0.1 - -[Load.VRFv2Plus.General] -randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 5.0 -subscription_funding_amount_native=1 - -[Load.VRFv2Plus.Performance] -test_duration = "2m" -rate_limit_unit_duration = "3s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -# STRESS TEST CONFIG -[Stress.Common] -chainlink_node_funding = 0.1 - -[Stress.VRFv2Plus.General] -randomness_request_count_per_request = 30 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "10s" -rps = 1 -bhs_test_duration = "1m" -bhs_test_rate_limit_unit_duration = "3s" -bhs_test_rps = 1 - -### POLYGON AMOY Config -[POLYGON_AMOY.Common] -chainlink_node_funding = 5 -[POLYGON_AMOY.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 3 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 500 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "19823132181656390000" -staleness_seconds = 172_800 -gas_after_payment_calculation = 48_500 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 84 -link_premium_percentage = 70 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 99_500 -coordinator_gas_overhead_link = 121_500 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 84 -coordinator_link_premium_percentage = 70 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 3.0 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "2s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "latest" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[POLYGON_AMOY-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "15m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 3 - -[POLYGON_AMOY-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[POLYGON_AMOY-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[POLYGON_AMOY-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 150 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[POLYGON_AMOY-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### ARBITRUM SEPOLIA Config -[ARBITRUM_SEPOLIA.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 - -## NEW ENV CONFIG -## CL Node config -cl_node_max_gas_price_gwei = 50 -number_of_sending_keys_to_create = 0 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "5352799651145251" -staleness_seconds = 172_800 -gas_after_payment_calculation = 56000 -fulfillment_flat_fee_native_ppm=0 -fulfillment_flat_fee_link_discount_ppm=0 -native_premium_percentage=60 -link_premium_percentage=50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 104_500 -coordinator_gas_overhead_link = 126_500 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage=60 -coordinator_link_premium_percentage=50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 3.0 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "300ms" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block="pending" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "300ms" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - - - -#SMOKE TEST CONFIG -[ARBITRUM_SEPOLIA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 5 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 5 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "100s" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[ARBITRUM_SEPOLIA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[ARBITRUM_SEPOLIA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[ARBITRUM_SEPOLIA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 150 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[ARBITRUM_SEPOLIA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### AVALANCHE FUJI Config -[AVALANCHE_FUJI.Common] -chainlink_node_funding = 3 -[AVALANCHE_FUJI.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 300 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "378709808510249900" -staleness_seconds = 172_800 -gas_after_payment_calculation = 56_000 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 60 -link_premium_percentage = 50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 107_000 -coordinator_gas_overhead_link = 129_000 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 60 -coordinator_link_premium_percentage = 50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 3.0 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "2s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "pending" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[AVALANCHE_FUJI-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "10m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[AVALANCHE_FUJI-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[AVALANCHE_FUJI-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[AVALANCHE_FUJI-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[AVALANCHE_FUJI-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### BASE SEPOLIA Config -[BASE_SEPOLIA.Common] -chainlink_node_funding = 5 -[BASE_SEPOLIA.VRFv2Plus.General] -use_test_coordinator = false -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 30 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "3962147213857640" -staleness_seconds = 172_800 -gas_after_payment_calculation = 42_500 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 60 -link_premium_percentage = 50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 128_500 -coordinator_gas_overhead_link = 150_400 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 60 -coordinator_link_premium_percentage = 50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.15 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "2s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "pending" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[BASE_SEPOLIA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "10m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[BASE_SEPOLIA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[BASE_SEPOLIA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[BASE_SEPOLIA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[BASE_SEPOLIA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - - -### OPTIMISM SEPOLIA Config -[OPTIMISM_SEPOLIA.Common] -chainlink_node_funding = 5 -[OPTIMISM_SEPOLIA.VRFv2Plus.General] -sub_billing_tolerance_wei = 1e16 -use_test_coordinator = false -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 30 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "3896881047706782" -staleness_seconds = 172_800 -gas_after_payment_calculation = 42_500 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 60 -link_premium_percentage = 50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 128_500 -coordinator_gas_overhead_link = 150_400 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 60 -coordinator_link_premium_percentage = 50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.15 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "2s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "pending" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[OPTIMISM_SEPOLIA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 10 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 10 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "10m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[OPTIMISM_SEPOLIA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[OPTIMISM_SEPOLIA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[OPTIMISM_SEPOLIA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[OPTIMISM_SEPOLIA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - - -### SONEIUM SEPOLIA Config -[SONEIUM_SEPOLIA.Common] -chainlink_node_funding = 5 -[SONEIUM_SEPOLIA.VRFv2Plus.General] -use_test_coordinator = false -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 30 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "4619667900000000" -staleness_seconds = 172_800 -gas_after_payment_calculation = 42_500 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 60 -link_premium_percentage = 50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 128_500 -coordinator_gas_overhead_link = 150_400 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 60 -coordinator_link_premium_percentage = 50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.15 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "2s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "pending" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[SONEIUM_SEPOLIA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "10m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[SONEIUM_SEPOLIA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[SONEIUM_SEPOLIA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[SONEIUM_SEPOLIA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[SONEIUM_SEPOLIA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - - -### ETH SEPOLIA Config -[SEPOLIA.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 3 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 100 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "5354747932930759" -staleness_seconds = 172_800 -gas_after_payment_calculation = 38_900 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 24 -link_premium_percentage = 20 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 90_000 -coordinator_gas_overhead_link = 112_000 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 24 -coordinator_link_premium_percentage = 20 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.15 -vrf_job_batch_fulfillment_enabled = false -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "5s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "latest" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "30s" -bhs_job_run_timeout = "1m0s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[SEPOLIA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "70m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 3 - -[SEPOLIA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[SEPOLIA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[SEPOLIA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 30 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[SEPOLIA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### BSC TESTNET Config -[BSC_TESTNET.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 3 - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -# NEW ENV CONFIG -# CL Node config -cl_node_max_gas_price_gwei = 50 -number_of_sending_keys_to_create = 0 - -# Coordinator config -max_gas_limit_coordinator_config = 2500000 -fallback_wei_per_unit_link = "30531029880396850" -staleness_seconds = 172_800 -gas_after_payment_calculation = 48_500 -fulfillment_flat_fee_native_ppm = 0 -fulfillment_flat_fee_link_discount_ppm = 0 -native_premium_percentage = 60 -link_premium_percentage = 50 - -# Wrapper config -wrapped_gas_overhead = 13_400 -coordinator_gas_overhead_native = 99_500 -coordinator_gas_overhead_link = 121_500 -coordinator_gas_overhead_per_word = 435 -coordinator_native_premium_percentage = 60 -coordinator_link_premium_percentage = 50 -wrapper_max_number_of_words = 10 - -# VRF Job config -vrf_job_forwarding_allowed = false -vrf_job_estimate_gas_multiplier = 1.1 -vrf_job_batch_fulfillment_enabled = true -vrf_job_batch_fulfillment_gas_multiplier = 1.1 -vrf_job_poll_period = "3s" -vrf_job_request_timeout = "2h0m0s" -vrf_job_simulation_block = "latest" - -# BHS Job config -bhs_job_wait_blocks = 30 -bhs_job_lookback_blocks = 200 -bhs_job_poll_period = "2s" -bhs_job_run_timeout = "30s" -# NEW ENV CONFIG END - -#SMOKE TEST CONFIG -[BSC_TESTNET-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 3 -subscription_funding_amount_native = 1 -subscription_refunding_amount_link = 3 -subscription_refunding_amount_native = 1 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "15m" - -wrapper_consumer_funding_amount_native_token = 1.0 -wrapper_consumer_funding_amount_link = 5 - -[BSC_TESTNET-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[BSC_TESTNET-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[BSC_TESTNET-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[BSC_TESTNET-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### NEXON QA Config -[NEXON_QA.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 -generate_txs_on_chain = true - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -#SMOKE TEST CONFIG -[NEXON_QA-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 21 -subscription_funding_amount_native = 2 -subscription_refunding_amount_link = 21 -subscription_refunding_amount_native = 2 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "25m" -wrapper_consumer_funding_amount_link = 21 -wrapper_consumer_funding_amount_native_token = 3 - -[NEXON_QA-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[NEXON_QA-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[NEXON_QA-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[NEXON_QA-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### NEXON DEV Config -[NEXON_DEV.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 -generate_txs_on_chain = true - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - -#SMOKE TEST CONFIG -[NEXON_DEV-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 21 -subscription_funding_amount_native = 2 -subscription_refunding_amount_link = 21 -subscription_refunding_amount_native = 2 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "25m" -wrapper_consumer_funding_amount_link = 21 -wrapper_consumer_funding_amount_native_token = 3 - -[NEXON_DEV-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[NEXON_DEV-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[NEXON_DEV-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[NEXON_DEV-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - -### NEXON TEST Config -[NEXON_TEST.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 -generate_txs_on_chain = true - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - - -#SMOKE TEST CONFIG -[NEXON_TEST-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 21 -subscription_funding_amount_native = 2 -subscription_refunding_amount_link = 21 -subscription_refunding_amount_native = 2 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "25m" -wrapper_consumer_funding_amount_link = 5 -wrapper_consumer_funding_amount_native_token = 3 - -[NEXON_TEST-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[NEXON_TEST-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[NEXON_TEST-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[NEXON_TEST-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 - - -### NEXON STAGE Config -[NEXON_STAGE.VRFv2Plus.General] -use_test_coordinator = true -#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request -minimum_confirmations = 0 -generate_txs_on_chain = true - -# Consumer Request config -subscription_billing_type = "LINK_AND_NATIVE" -callback_gas_limit = 1000000 - - -#SMOKE TEST CONFIG -[NEXON_STAGE-Smoke.VRFv2Plus.General] -randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -subscription_funding_amount_link = 21 -subscription_funding_amount_native = 2 -subscription_refunding_amount_link = 21 -subscription_refunding_amount_native = 2 -number_of_words = 1 -random_words_fulfilled_event_timeout = "1m30s" -wait_for_256_blocks_timeout = "25m" -wrapper_consumer_funding_amount_link = 21 -wrapper_consumer_funding_amount_native_token = 3 - -[NEXON_STAGE-Soak.VRFv2Plus.General] -randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native = 100 - -[NEXON_STAGE-Soak.VRFv2Plus.Performance] -test_duration = "2h" -rate_limit_unit_duration = "10s" -rps = 1 - -[NEXON_STAGE-Stress.VRFv2Plus.General] -randomness_request_count_per_request = 60 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting -number_of_sub_to_create = 1 -number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 500 -subscription_funding_amount_native=100 - -[NEXON_STAGE-Stress.VRFv2Plus.Performance] -test_duration = "10m" -rate_limit_unit_duration = "1m" -rps = 1 diff --git a/integration-tests/testreporters/keeper.go b/integration-tests/testreporters/keeper.go deleted file mode 100644 index ebc4ab55bb2..00000000000 --- a/integration-tests/testreporters/keeper.go +++ /dev/null @@ -1,172 +0,0 @@ -package testreporters - -import ( - "encoding/csv" - "encoding/json" - "fmt" - "os" - "path/filepath" - "strconv" - "sync" - "testing" - - "github.com/rs/zerolog/log" - "github.com/slack-go/slack" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" -) - -// KeeperBlockTimeTestReporter enables reporting on the keeper block time test -type KeeperBlockTimeTestReporter struct { - Reports []KeeperBlockTimeTestReport `json:"reports"` - ReportMutex sync.Mutex - AttemptedChainlinkTransactions []*nodeclient.TransactionsData `json:"attemptedChainlinkTransactions"` - - namespace string - keeperReportFile string - attemptedTransactionsFile string -} - -// KeeperBlockTimeTestReport holds a report information for a single Upkeep Consumer contract -type KeeperBlockTimeTestReport struct { - ContractAddress string `json:"contractAddress"` - TotalExpectedUpkeeps int64 `json:"totalExpectedUpkeeps"` - TotalSuccessfulUpkeeps int64 `json:"totalSuccessfulUpkeeps"` - AllMissedUpkeeps []int64 `json:"allMissedUpkeeps"` // List of each time an upkeep was missed, represented by how many blocks it was missed by -} - -func (k *KeeperBlockTimeTestReporter) SetNamespace(namespace string) { - k.namespace = namespace -} - -func (k *KeeperBlockTimeTestReporter) WriteReport(folderLocation string) error { - k.keeperReportFile = filepath.Join(folderLocation, "./block_time_report.csv") - k.attemptedTransactionsFile = filepath.Join(folderLocation, "./attempted_transactions_report.json") - keeperReportFile, err := os.Create(k.keeperReportFile) - if err != nil { - return err - } - defer keeperReportFile.Close() - - keeperReportWriter := csv.NewWriter(keeperReportFile) - err = keeperReportWriter.Write([]string{ - "Contract Index", - "Contract Address", - "Total Expected Upkeeps", - "Total Successful Upkeeps", - "Total Missed Upkeeps", - "Average Blocks Missed", - "Largest Missed Upkeep", - "Percent Successful", - }) - if err != nil { - return err - } - var totalExpected, totalSuccessful, totalMissed, worstMiss int64 - for contractIndex, report := range k.Reports { - avg, maxVal := int64AvgMax(report.AllMissedUpkeeps) - err = keeperReportWriter.Write([]string{ - strconv.Itoa(contractIndex), - report.ContractAddress, - strconv.FormatInt(report.TotalExpectedUpkeeps, 10), - strconv.FormatInt(report.TotalSuccessfulUpkeeps, 10), - strconv.Itoa(len(report.AllMissedUpkeeps)), - fmt.Sprint(avg), - strconv.FormatInt(maxVal, 10), - fmt.Sprintf("%.2f%%", (float64(report.TotalSuccessfulUpkeeps)/float64(report.TotalExpectedUpkeeps))*100), - }) - totalExpected += report.TotalExpectedUpkeeps - totalSuccessful += report.TotalSuccessfulUpkeeps - totalMissed += int64(len(report.AllMissedUpkeeps)) - worstMiss = max(maxVal, worstMiss) - if err != nil { - return err - } - } - keeperReportWriter.Flush() - - err = keeperReportWriter.Write([]string{"Full Test Summary"}) - if err != nil { - return err - } - err = keeperReportWriter.Write([]string{"Total Expected", "Total Successful", "Total Missed", "Worst Miss", "Total Percent"}) - if err != nil { - return err - } - err = keeperReportWriter.Write([]string{ - strconv.FormatInt(totalExpected, 10), - strconv.FormatInt(totalSuccessful, 10), - strconv.FormatInt(totalMissed, 10), - strconv.FormatInt(worstMiss, 10), - fmt.Sprintf("%.2f%%", (float64(totalSuccessful)/float64(totalExpected))*100)}) - if err != nil { - return err - } - keeperReportWriter.Flush() - - txs, err := json.Marshal(k.AttemptedChainlinkTransactions) - if err != nil { - return err - } - err = os.WriteFile(k.attemptedTransactionsFile, txs, 0600) - if err != nil { - return err - } - - log.Info().Msg("Successfully wrote report on Keeper Block Timing") - return nil -} - -// SendSlackNotification sends a slack notification on the results of the test -func (k *KeeperBlockTimeTestReporter) SendSlackNotification(t *testing.T, slackClient *slack.Client) error { - if slackClient == nil { - slackClient = slack.New(testreporters.SlackAPIKey) - } - - testFailed := t.Failed() - headerText := ":white_check_mark: Keeper Block Time Test PASSED :white_check_mark:" - if testFailed { - headerText = ":x: Keeper Block Time Test FAILED :x:" - } - messageBlocks := testreporters.CommonSlackNotificationBlocks( - headerText, k.namespace, k.keeperReportFile, - ) - ts, err := testreporters.SendSlackMessage(slackClient, slack.MsgOptionBlocks(messageBlocks...)) - if err != nil { - return err - } - - if err := testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "Keeper Block Time Test Report " + k.namespace, - Filename: fmt.Sprintf("keeper_block_time_%s.csv", k.namespace), - File: k.keeperReportFile, - InitialComment: "Keeper Block Time Test Report " + k.namespace, - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }); err != nil { - return err - } - return testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "Keeper Block Time Attempted Chainlink Txs " + k.namespace, - Filename: fmt.Sprintf("attempted_cl_txs_%s.json", k.namespace), - File: k.attemptedTransactionsFile, - InitialComment: "Keeper Block Time Attempted Txs " + k.namespace, - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }) -} - -// int64AvgMax helper calculates the avg and the max values in a list -func int64AvgMax(in []int64) (float64, int64) { - var sum int64 - var val int64 // max - if len(in) == 0 { - return 0, 0 - } - for _, num := range in { - sum += num - val = max(val, num) - } - return float64(sum) / float64(len(in)), val -} diff --git a/integration-tests/testreporters/keeper_benchmark.go b/integration-tests/testreporters/keeper_benchmark.go deleted file mode 100644 index 404e566b8d0..00000000000 --- a/integration-tests/testreporters/keeper_benchmark.go +++ /dev/null @@ -1,326 +0,0 @@ -package testreporters - -import ( - "encoding/csv" - "encoding/json" - "fmt" - "math" - "os" - "path/filepath" - "slices" - "strconv" - "sync" - "testing" - - "github.com/rs/zerolog/log" - "github.com/slack-go/slack" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" -) - -// KeeperBenchmarkTestReporter enables reporting on the keeper benchmark test -type KeeperBenchmarkTestReporter struct { - Reports []KeeperBenchmarkTestReport `json:"reports"` - ReportMutex sync.Mutex - AttemptedChainlinkTransactions []*nodeclient.TransactionsData `json:"attemptedChainlinkTransactions"` - NumRevertedUpkeeps int64 - NumStaleUpkeepReports int64 - Summary KeeperBenchmarkTestSummary `json:"summary"` - - namespace string - keeperReportFile string - attemptedTransactionsFile string - keeperSummaryFile string -} - -type KeeperBenchmarkTestSummary struct { - Load KeeperBenchmarkTestLoad `json:"load"` - Config KeeperBenchmarkTestConfig `json:"config"` - Metrics KeeperBenchmarkTestMetrics `json:"metrics"` - TestInputs map[string]any `json:"testInputs"` - StartTime int64 `json:"startTime"` - EndTime int64 `json:"endTime"` -} - -type KeeperBenchmarkTestLoad struct { - TotalCheckGasPerBlock int64 `json:"totalCheckGasPerBlock"` - TotalPerformGasPerBlock int64 `json:"totalPerformGasPerBlock"` - AverageExpectedPerformsPerBlock float64 `json:"averageExpectedPerformsPerBlock"` -} - -type KeeperBenchmarkTestConfig struct { - Chainlink map[string]map[string]string `json:"chainlink"` - Geth map[string]map[string]string `json:"geth"` -} - -type KeeperBenchmarkTestMetrics struct { - Delay map[string]any `json:"delay"` - PercentWithinSLA float64 `json:"percentWithinSLA"` - PercentRevert float64 `json:"percentRevert"` - PercentStale float64 `json:"percentStale"` - TotalTimesEligible int64 `json:"totalTimesEligible"` - TotalTimesPerformed int64 `json:"totalTimesPerformed"` - TotalStaleReports int64 `json:"totalStaleReports"` - AverageActualPerformsPerBlock float64 `json:"averageActualPerformsPerBlock"` -} - -// KeeperBenchmarkTestReport holds a report information for a single Upkeep Consumer contract -type KeeperBenchmarkTestReport struct { - RegistryAddress string `json:"registryAddress"` - ContractAddress string `json:"contractAddress"` - TotalEligibleCount int64 `json:"totalEligibleCount"` - TotalSLAMissedUpkeeps int64 `json:"totalSLAMissedUpkeeps"` - TotalPerformedUpkeeps int64 `json:"totalPerformedUpkeeps"` - AllCheckDelays []int64 `json:"allCheckDelays"` // List of the delays since checkUpkeep for all performs -} - -func (k *KeeperBenchmarkTestReporter) SetNamespace(namespace string) { - k.namespace = namespace -} - -func (k *KeeperBenchmarkTestReporter) WriteReport(folderLocation string) error { - k.keeperReportFile = filepath.Join(folderLocation, "./benchmark_report.csv") - k.keeperSummaryFile = filepath.Join(folderLocation, "./benchmark_summary.json") - // k.keeperSummaryCsvFile = filepath.Join(folderLocation, "./benchmark_summary.csv") - k.attemptedTransactionsFile = filepath.Join(folderLocation, "./attempted_transactions_report.json") - keeperReportFile, err := os.Create(k.keeperReportFile) - if err != nil { - return err - } - defer keeperReportFile.Close() - - keeperReportWriter := csv.NewWriter(keeperReportFile) - var totalEligibleCount, totalPerformed, totalMissedSLA, totalReverted, totalStaleReports int64 - var allDelays []int64 - for _, report := range k.Reports { - totalEligibleCount += report.TotalEligibleCount - totalPerformed += report.TotalPerformedUpkeeps - totalMissedSLA += report.TotalSLAMissedUpkeeps - - allDelays = append(allDelays, report.AllCheckDelays...) - } - totalReverted = k.NumRevertedUpkeeps - totalStaleReports = k.NumStaleUpkeepReports - pctWithinSLA := (1.0 - float64(totalMissedSLA)/float64(totalEligibleCount)) * 100 - var pctReverted, pctStale float64 - if totalPerformed > 0 { - pctReverted = (float64(totalReverted) / float64(totalPerformed)) * 100 - pctStale = (float64(totalStaleReports) / float64(totalPerformed)) * 100 - } - - err = keeperReportWriter.Write([]string{"Full Test Summary"}) - if err != nil { - return err - } - err = keeperReportWriter.Write([]string{ - "Total Times Eligible", - "Total Performed", - "Total Reverted", - "Total Stale Reports", - "Average Perform Delay", - "Median Perform Delay", - "90th pct Perform Delay", - "99th pct Perform Delay", - "Max Perform Delay", - "Percent Within SLA", - "Percent Revert", - "Percent Stale", - }) - if err != nil { - return err - } - avg, median, ninetyPct, ninetyNinePct, maxVal := IntListStats(allDelays) - err = keeperReportWriter.Write([]string{ - strconv.FormatInt(totalEligibleCount, 10), - strconv.FormatInt(totalPerformed, 10), - strconv.FormatInt(totalReverted, 10), - strconv.FormatInt(totalStaleReports, 10), - fmt.Sprintf("%.2f", avg), - strconv.FormatInt(median, 10), - strconv.FormatInt(ninetyPct, 10), - strconv.FormatInt(ninetyNinePct, 10), - strconv.FormatInt(maxVal, 10), - fmt.Sprintf("%.2f%%", pctWithinSLA), - fmt.Sprintf("%.2f%%", pctReverted), - fmt.Sprintf("%.2f%%", pctStale), - }) - if err != nil { - return err - } - keeperReportWriter.Flush() - log.Info(). - Int64("Total Times Eligible", totalEligibleCount). - Int64("Total Performed", totalPerformed). - Int64("Total Reverted", totalReverted). - Float64("Average Perform Delay", avg). - Int64("Median Perform Delay", median). - Int64("90th pct Perform Delay", ninetyPct). - Int64("99th pct Perform Delay", ninetyNinePct). - Int64("Max Perform Delay", maxVal). - Float64("Percent Within SLA", pctWithinSLA). - Float64("Percent Reverted", pctReverted). - Msg("Calculated Aggregate Results") - - err = keeperReportWriter.Write([]string{ - "Contract Index", - "RegistryAddress", - "Contract Address", - "Total Times Eligible", - "Total Performed Upkeeps", - "Average Perform Delay", - "Median Perform Delay", - "90th pct Perform Delay", - "99th pct Perform Delay", - "Largest Perform Delay", - "Percent Within SLA", - }) - if err != nil { - return err - } - - for contractIndex, report := range k.Reports { - avg, median, ninetyPct, ninetyNinePct, maxVal = IntListStats(report.AllCheckDelays) - err = keeperReportWriter.Write([]string{ - strconv.Itoa(contractIndex), - report.RegistryAddress, - report.ContractAddress, - strconv.FormatInt(report.TotalEligibleCount, 10), - strconv.FormatInt(report.TotalPerformedUpkeeps, 10), - fmt.Sprintf("%.2f", avg), - strconv.FormatInt(median, 10), - strconv.FormatInt(ninetyPct, 10), - strconv.FormatInt(ninetyNinePct, 10), - strconv.FormatInt(maxVal, 10), - fmt.Sprintf("%.2f%%", (1.0-float64(report.TotalSLAMissedUpkeeps)/float64(report.TotalEligibleCount))*100), - }) - if err != nil { - return err - } - } - keeperReportWriter.Flush() - - txs, err := json.Marshal(k.AttemptedChainlinkTransactions) - if err != nil { - return err - } - err = os.WriteFile(k.attemptedTransactionsFile, txs, 0600) - if err != nil { - return err - } - - log.Info().Msg("Successfully wrote report on Keeper Benchmark") - - k.Summary.Metrics.Delay = map[string]any{ - "mean": avg, - "median": median, - "90p": ninetyPct, - "99p": ninetyNinePct, - "max": maxVal, - } - k.Summary.Metrics.PercentWithinSLA = pctWithinSLA - k.Summary.Metrics.PercentRevert = pctReverted - k.Summary.Metrics.TotalTimesEligible = totalEligibleCount - k.Summary.Metrics.TotalTimesPerformed = totalPerformed - k.Summary.Metrics.TotalStaleReports = totalStaleReports - k.Summary.Metrics.PercentStale = pctStale - if k.Summary.TestInputs["BlockRange"] != nil { - k.Summary.Metrics.AverageActualPerformsPerBlock = float64(totalPerformed) / float64(k.Summary.TestInputs["BlockRange"].(int64)) - } - // TODO: Set test expectations - /* Expect(int64(pctWithinSLA)).Should(BeNumerically(">=", int64(80)), "Expected PercentWithinSLA to be greater than or equal to 80, but got %f", pctWithinSLA) - Expect(int64(pctReverted)).Should(BeNumerically("<=", int64(10)), "Expected PercentRevert to be less than or equal to 10, but got %f", pctReverted) - Expect(k.Summary.Metrics.AverageActualPerformsPerBlock).Should(BeNumerically("~", k.Summary.Load.AverageExpectedPerformsPerBlock, 10), "Expected PercentRevert to be less than 10, but got %f", pctReverted) */ - - res, err := json.MarshalIndent(k.Summary, "", " ") - if err != nil { - return err - } - err = os.WriteFile(k.keeperSummaryFile, res, 0600) - if err != nil { - return err - } - - log.Info().Str("Summary", string(res)).Msg("Successfully wrote summary on Keeper Benchmark") - - return nil -} - -// SendSlackNotification sends a slack notification on the results of the test -func (k *KeeperBenchmarkTestReporter) SendSlackNotification(t *testing.T, slackClient *slack.Client, grafanaUrlProvider testreporters.GrafanaURLProvider) error { - if slackClient == nil { - slackClient = slack.New(testreporters.SlackAPIKey) - } - - testFailed := t.Failed() - headerText := ":white_check_mark: Automation Benchmark Test FINISHED :white_check_mark:" - if testFailed { - headerText = ":x: Automation Benchmark Test FAILED :x:" - } - messageBlocks := testreporters.CommonSlackNotificationBlocks( - headerText, k.namespace, k.keeperReportFile, - ) - ts, err := testreporters.SendSlackMessage(slackClient, slack.MsgOptionBlocks(messageBlocks...)) - if err != nil { - return err - } - - grafanaUrl, err := grafanaUrlProvider.GetGrafanaBaseURL() - if err != nil { - return err - } - - dashboardUrl, err := grafanaUrlProvider.GetGrafanaDashboardURL() - if err != nil { - return err - } - - formattedDashboardURL := fmt.Sprintf("%s%s?from=%d&to=%d&var-namespace=%s&var-cl_node=chainlink-0-0", grafanaUrl, dashboardUrl, k.Summary.StartTime, k.Summary.EndTime, k.namespace) - log.Info().Str("Dashboard", formattedDashboardURL).Msg("Dashboard URL") - - if err := testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "Automation Benchmark Test Summary " + k.namespace, - Filename: fmt.Sprintf("automation_benchmark_summary_%s.json", k.namespace), - File: k.keeperSummaryFile, - InitialComment: fmt.Sprintf("Automation Benchmark Test Summary %s.\n<%s|Test Dashboard> ", k.namespace, formattedDashboardURL), - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }); err != nil { - return err - } - - if err := testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "Automation Benchmark Test Report " + k.namespace, - Filename: fmt.Sprintf("automation_benchmark_report_%s.csv", k.namespace), - File: k.keeperReportFile, - InitialComment: "Automation Benchmark Test Report " + k.namespace, - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }); err != nil { - return err - } - return testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "Automation Benchmark Attempted Chainlink Txs " + k.namespace, - Filename: fmt.Sprintf("attempted_cl_txs_%s.json", k.namespace), - File: k.attemptedTransactionsFile, - InitialComment: "Automation Benchmark Attempted Txs " + k.namespace, - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }) -} - -// intListStats helper calculates some statistics on an int list: avg, median, 90pct, 99pct, max -// -//nolint:revive -func IntListStats(in []int64) (float64, int64, int64, int64, int64) { - length := len(in) - if length == 0 { - return 0, 0, 0, 0, 0 - } - slices.Sort(in) - var sum int64 - for _, num := range in { - sum += num - } - return float64(sum) / float64(length), in[int(math.Floor(float64(length)*0.5))], in[int(math.Floor(float64(length)*0.9))], in[int(math.Floor(float64(length)*0.99))], in[length-1] -} diff --git a/integration-tests/testreporters/ocr.go b/integration-tests/testreporters/ocr.go deleted file mode 100644 index 481cba15c98..00000000000 --- a/integration-tests/testreporters/ocr.go +++ /dev/null @@ -1,266 +0,0 @@ -package testreporters - -import ( - "encoding/csv" - "fmt" - "os" - "path/filepath" - "sort" - "testing" - "time" - - "github.com/rs/zerolog/log" - "github.com/slack-go/slack" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" -) - -//TODO: This whole process can definitely be simplified and improved, but for some reason I'm getting brain block at the moment - -// OCRSoakTestReporter collates all OCRAnswerUpdated events into a single report -type OCRSoakTestReporter struct { - StartTime time.Time - AnomaliesDetected bool - OCRVersion string - - anomalies [][]string - timeLine [][]string - namespace string - csvLocation string -} - -// TimeLineEvent represents a single event in the timeline -type TimeLineEvent interface { - Time() time.Time - CSV() [][]string -} - -// TestIssue is a single RPC issue, either a disconnect or reconnect -type TestIssue struct { - StartTime time.Time `toml:"startTime"` - Message string `toml:"message"` -} - -func (r *TestIssue) Time() time.Time { - return r.StartTime -} - -func (r *TestIssue) CSV() [][]string { - return [][]string{{r.StartTime.Format("2006-01-02 15:04:05.00 MST"), "Test Issue!", r.Message}} -} - -// OCRRoundState indicates that a round per contract should complete within this time with this answer -type OCRRoundState struct { - StartTime time.Time `toml:"startTime"` - EndTime time.Time `toml:"endTime"` // Time when the round should end, only used for analysis - Answer int64 `toml:"answer"` - Anomalous bool `toml:"anomalous"` // Whether the round was anomalous - FoundEvents map[string][]*FoundEvent `toml:"foundEvents"` // Address -> FoundEvents, possible to have multiple found events per round, and need to call it out - TimeLineEvents []TimeLineEvent `toml:"timeLineEvents"` - - anomalies [][]string -} - -func (e *OCRRoundState) Time() time.Time { - return e.StartTime -} - -// CSV returns a CSV representation of the test state and all events -func (e *OCRRoundState) CSV() [][]string { - rows := [][]string{{e.StartTime.Format("2006-01-02 15:04:05.00 MST"), fmt.Sprintf("Expecting new Answer: %d", e.Answer)}} - rows = append(rows, e.anomalies...) - return rows -} - -// Validate checks that -// 1. There is a FoundEvent for every address -// 2. There is only one FoundEvent for every address -// 3. The answer is correct -func (e *OCRRoundState) Validate() bool { - anomalies := [][]string{} - for address, eventList := range e.FoundEvents { - if len(eventList) == 0 { - e.Anomalous = true - anomalies = append(anomalies, []string{ - e.StartTime.Format("2006-01-02 15:04:05.00 MST"), "Anomaly Found!", fmt.Sprintf("No AnswerUpdated for address '%s'", address), - }) - } else if len(eventList) > 1 { - e.Anomalous = true - anomalies = append(anomalies, []string{e.StartTime.Format("2006-01-02 15:04:05.00 MST"), "Anomaly Found!", - fmt.Sprintf("Multiple AnswerUpdated for address '%s', possible double-transmission", address)}, - ) - } else { - event := eventList[0] - if event.Answer != e.Answer { - e.Anomalous = true - anomalies = append(e.anomalies, []string{e.StartTime.Format("2006-01-02 15:04:05.00 MST"), "Anomaly Found!", - fmt.Sprintf("FoundEvent for address '%s' has wrong answer '%d'", address, event.Answer)}, - ) - } - } - } - e.anomalies = anomalies - return e.Anomalous -} - -// FoundEvent is a single round update event -type FoundEvent struct { - StartTime time.Time - BlockNumber uint64 - Address string - Answer int64 - RoundID uint64 -} - -func (a *FoundEvent) Time() time.Time { - return a.StartTime -} - -// CSV returns a CSV representation of the event -func (a *FoundEvent) CSV() [][]string { - return [][]string{{ - a.StartTime.Format("2006-01-02 15:04:05.00 MST"), - "Address: " + a.Address, - fmt.Sprintf("Round: %d", a.RoundID), - fmt.Sprintf("Answer: %d", a.Answer), - fmt.Sprintf("Block: %d", a.BlockNumber), - }} -} - -// RecordEvents takes in a list of test states and RPC issues, orders them, and records them in the timeline -func (o *OCRSoakTestReporter) RecordEvents(testStates []*OCRRoundState, testIssues []*TestIssue) { - events := []TimeLineEvent{} - for _, expectedEvent := range testStates { - if expectedEvent.Validate() { - o.AnomaliesDetected = true - o.anomalies = append(o.anomalies, expectedEvent.anomalies...) - } - events = append(events, expectedEvent) - events = append(events, expectedEvent.TimeLineEvents...) - } - if len(testIssues) > 0 { - o.AnomaliesDetected = true - } - for _, testIssue := range testIssues { - events = append(events, testIssue) - o.anomalies = append(o.anomalies, testIssue.CSV()...) - } - sort.Slice(events, func(i, j int) bool { - return events[i].Time().Before(events[j].Time()) - }) - for _, event := range events { - o.timeLine = append(o.timeLine, event.CSV()...) - } -} - -// SetNamespace sets the namespace of the report for clean reports -func (o *OCRSoakTestReporter) SetNamespace(namespace string) { - o.namespace = namespace -} - -// WriteReport writes OCR Soak test report to a CSV file and final report -func (o *OCRSoakTestReporter) WriteReport(folderLocation string) error { - log.Debug().Msgf("Writing OCRv%s Soak Test Report", o.OCRVersion) - reportLocation := filepath.Join(folderLocation, "./ocr_soak_report.csv") - o.csvLocation = reportLocation - ocrReportFile, err := os.Create(reportLocation) - if err != nil { - return err - } - defer ocrReportFile.Close() - - ocrReportWriter := csv.NewWriter(ocrReportFile) - - err = ocrReportWriter.Write([]string{fmt.Sprintf("OCRv%s Soak Test Report", o.OCRVersion)}) - if err != nil { - return err - } - - err = ocrReportWriter.Write([]string{ - "Namespace", - o.namespace, - "Started At", - o.StartTime.Format("2006-01-02 15:04:05.00 MST"), - "Test Duration", - time.Since(o.StartTime).String(), - }) - if err != nil { - return err - } - - err = ocrReportWriter.Write([]string{}) - if err != nil { - return err - } - - if len(o.anomalies) > 0 { - err = ocrReportWriter.Write([]string{"Anomalies Found"}) - if err != nil { - return err - } - - err = ocrReportWriter.WriteAll(o.anomalies) - if err != nil { - return err - } - - err = ocrReportWriter.Write([]string{}) - if err != nil { - return err - } - } - - err = ocrReportWriter.Write([]string{"Timeline"}) - if err != nil { - return err - } - - err = ocrReportWriter.Write([]string{ - "Time", - "Message", - }) - if err != nil { - return err - } - - err = ocrReportWriter.WriteAll(o.timeLine) - if err != nil { - return err - } - - ocrReportWriter.Flush() - - log.Info().Str("Location", reportLocation).Msg("Wrote CSV file") - return nil -} - -// SendNotification sends a slack message to a slack webhook and uploads test artifacts -func (o *OCRSoakTestReporter) SendSlackNotification(t *testing.T, slackClient *slack.Client, _ testreporters.GrafanaURLProvider) error { - if slackClient == nil { - slackClient = slack.New(testreporters.SlackAPIKey) - } - - testFailed := t.Failed() - headerText := fmt.Sprintf(":white_check_mark: OCRv%s Soak Test PASSED :white_check_mark:", o.OCRVersion) - if testFailed { - headerText = ":x: OCR Soak Test FAILED :x:" - } else if o.AnomaliesDetected { - headerText = ":warning: OCR Soak Test Found Anomalies :warning:" - } - messageBlocks := testreporters.CommonSlackNotificationBlocks( - headerText, fmt.Sprintf("%s | Test took: %s", o.namespace, time.Since(o.StartTime).Truncate(time.Second).String()), o.csvLocation, - ) - ts, err := testreporters.SendSlackMessage(slackClient, slack.MsgOptionBlocks(messageBlocks...)) - if err != nil { - return err - } - - return testreporters.UploadSlackFile(slackClient, slack.UploadFileV2Parameters{ - Title: "OCR Soak Test Report " + o.namespace, - Filename: fmt.Sprintf("ocr_soak_%s.csv", o.namespace), - File: o.csvLocation, - InitialComment: fmt.Sprintf("OCR Soak Test Report %s.", o.namespace), - Channel: testreporters.SlackChannel, - ThreadTimestamp: ts, - }) -} diff --git a/integration-tests/testreporters/profile.go b/integration-tests/testreporters/profile.go deleted file mode 100644 index 9892d3156b7..00000000000 --- a/integration-tests/testreporters/profile.go +++ /dev/null @@ -1,60 +0,0 @@ -package testreporters - -import ( - "fmt" - "os" - "path/filepath" - "testing" - - "github.com/rs/zerolog/log" - "github.com/slack-go/slack" - "golang.org/x/sync/errgroup" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" -) - -type ChainlinkProfileTestReporter struct { - Results []*nodeclient.ChainlinkProfileResults - namespace string -} - -// SetNamespace sets the namespace of the report for clean reports -func (c *ChainlinkProfileTestReporter) SetNamespace(namespace string) { - c.namespace = namespace -} - -// WriteReport create the profile files -func (c *ChainlinkProfileTestReporter) WriteReport(folderLocation string) error { - profFiles := new(errgroup.Group) - for _, res := range c.Results { - result := res - profFiles.Go(func() error { - filePath := filepath.Join(folderLocation, fmt.Sprintf("chainlink-node-%d-profiles", result.NodeIndex)) - if err := testreporters.MkdirIfNotExists(filePath); err != nil { - return err - } - for _, rep := range result.Reports { - report := rep - reportFile, err := os.Create(filepath.Join(filePath, report.Type)) - if err != nil { - return err - } - if _, err = reportFile.Write(report.Data); err != nil { - return err - } - if err = reportFile.Close(); err != nil { - return err - } - } - return nil - }) - } - return profFiles.Wait() -} - -// SendNotification hasn't been implemented for this test -func (c *ChainlinkProfileTestReporter) SendSlackNotification(_ *testing.T, _ *slack.Client, _ testreporters.GrafanaURLProvider) error { - log.Warn().Msg("No Slack notification integration for Chainlink profile tests") - return nil -} diff --git a/integration-tests/testreporters/vrfv2.go b/integration-tests/testreporters/vrfv2.go deleted file mode 100644 index ba17859512f..00000000000 --- a/integration-tests/testreporters/vrfv2.go +++ /dev/null @@ -1,79 +0,0 @@ -package testreporters - -import ( - "fmt" - "strings" - "testing" - "time" - - "github.com/slack-go/slack" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink/integration-tests/types" -) - -type VRFV2TestReporter struct { - TestType string - LoadTestMetrics VRFLoadTestMetrics - VRFv2TestConfig types.VRFv2TestConfig -} - -func (o *VRFV2TestReporter) SetReportData( - testType string, - metrics VRFLoadTestMetrics, - vrfv2TestConfig types.VRFv2TestConfig, -) { - o.TestType = testType - o.LoadTestMetrics = metrics - o.VRFv2TestConfig = vrfv2TestConfig -} - -// SendSlackNotification sends a slack message to a slack webhook -func (o *VRFV2TestReporter) SendSlackNotification(t *testing.T, slackClient *slack.Client) error { - if slackClient == nil { - slackClient = slack.New(testreporters.SlackAPIKey) - } - - testFailed := t.Failed() - headerText := fmt.Sprintf(":white_check_mark: VRF V2 %s Test PASSED :white_check_mark:", o.TestType) - if testFailed { - headerText = fmt.Sprintf(":x: VRF V2 %s Test FAILED :x:", o.TestType) - } - - perfCfg := o.VRFv2TestConfig.GetVRFv2Config().Performance - messageBlocks := testreporters.SlackNotifyBlocks(headerText, strings.Join(o.VRFv2TestConfig.GetNetworkConfig().SelectedNetworks, ","), []string{ - fmt.Sprintf( - "Summary\n"+ - "Perf Test Type: %s\n"+ - "Test Duration set in parameters: %s\n"+ - "Use Existing Env: %t\n"+ - "Request Count: %s\n"+ - "Fulfilment Count: %s\n"+ - "AverageFulfillmentInMillions: %s\n"+ - "Slowest Fulfillment: %s\n"+ - "Fastest Fulfillment: %s \n"+ - "RPS: %d\n"+ - "RateLimitUnitDuration: %s\n"+ - "RandomnessRequestCountPerRequest: %d\n"+ - "RandomnessRequestCountPerRequestDeviation: %d\n", - o.TestType, - perfCfg.TestDuration.Duration.Truncate(time.Second).String(), - *o.VRFv2TestConfig.GetVRFv2Config().General.UseExistingEnv, - o.LoadTestMetrics.RequestCount.String(), - o.LoadTestMetrics.FulfilmentCount.String(), - o.LoadTestMetrics.AverageFulfillmentInMillions.String(), - o.LoadTestMetrics.SlowestFulfillment.String(), - o.LoadTestMetrics.FastestFulfillment.String(), - *perfCfg.RPS, - perfCfg.RateLimitUnitDuration.String(), - *o.VRFv2TestConfig.GetVRFv2Config().General.RandomnessRequestCountPerRequest, - *o.VRFv2TestConfig.GetVRFv2Config().General.RandomnessRequestCountPerRequestDeviation, - ), - }) - - _, err := testreporters.SendSlackMessage(slackClient, slack.MsgOptionBlocks(messageBlocks...)) - if err != nil { - return err - } - return nil -} diff --git a/integration-tests/testreporters/vrfv2plus.go b/integration-tests/testreporters/vrfv2plus.go deleted file mode 100644 index b71c0b7d928..00000000000 --- a/integration-tests/testreporters/vrfv2plus.go +++ /dev/null @@ -1,105 +0,0 @@ -package testreporters - -import ( - "fmt" - "math/big" - "strings" - "testing" - "time" - - "github.com/smartcontractkit/chainlink/integration-tests/types" - - "github.com/slack-go/slack" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" -) - -type VRFV2PlusTestReporter struct { - TestType string - LoadTestMetrics VRFLoadTestMetrics - VRFv2PlusTestConfig types.VRFv2PlusTestConfig -} - -// todo - fix import cycle to avoid struct duplicate -type VRFLoadTestMetrics struct { - RequestCount *big.Int - FulfilmentCount *big.Int - AverageFulfillmentInMillions *big.Int - SlowestFulfillment *big.Int - FastestFulfillment *big.Int - P90FulfillmentBlockTime float64 - P95FulfillmentBlockTime float64 - AverageResponseTimeInSecondsMillions *big.Int - SlowestResponseTimeInSeconds *big.Int - FastestResponseTimeInSeconds *big.Int -} - -func (o *VRFV2PlusTestReporter) SetReportData( - testType string, - metrics VRFLoadTestMetrics, - testConfig types.VRFv2PlusTestConfig, -) { - o.TestType = testType - o.LoadTestMetrics = metrics - o.VRFv2PlusTestConfig = testConfig -} - -// SendSlackNotification sends a slack message to a slack webhook -func (o *VRFV2PlusTestReporter) SendSlackNotification(t *testing.T, slackClient *slack.Client, vtfv2PlusTestConfig types.VRFv2PlusTestConfig) error { - if slackClient == nil { - slackClient = slack.New(testreporters.SlackAPIKey) - } - - testFailed := t.Failed() - headerText := fmt.Sprintf(":white_check_mark: VRF V2 Plus %s Test PASSED :white_check_mark:", o.TestType) - if testFailed { - headerText = fmt.Sprintf(":x: VRF V2 Plus %s Test FAILED :x:", o.TestType) - } - - perfCfg := o.VRFv2PlusTestConfig.GetVRFv2PlusConfig().Performance - messageBlocks := testreporters.SlackNotifyBlocks(headerText, strings.Join(vtfv2PlusTestConfig.GetNetworkConfig().SelectedNetworks, ","), []string{ - fmt.Sprintf( - "Summary\n"+ - "Perf Test Type: %s\n"+ - "Test Duration set in parameters: %s\n"+ - "Use Existing Env: %t\n"+ - "Request Count: %s\n"+ - "Fulfilment Count: %s\n"+ - "AverageFulfillmentInMillions (blocks): %s\n"+ - "Slowest Fulfillment (blocks): %s\n"+ - "P90 Fulfillment (blocks): %f\n"+ - "P95 Fulfillment (blocks): %f\n"+ - "Fastest Fulfillment (blocks): %s \n"+ - "AverageFulfillmentInMillions (seconds): %s\n"+ - "Slowest Fulfillment (seconds): %s\n"+ - "Fastest Fulfillment (seconds): %s \n"+ - "RPS: %d\n"+ - "RateLimitUnitDuration: %s\n"+ - "RandomnessRequestCountPerRequest: %d\n"+ - "RandomnessRequestCountPerRequestDeviation: %d\n", - o.TestType, - perfCfg.TestDuration.Duration.Truncate(time.Second).String(), - *o.VRFv2PlusTestConfig.GetVRFv2PlusConfig().General.UseExistingEnv, - o.LoadTestMetrics.RequestCount.String(), - o.LoadTestMetrics.FulfilmentCount.String(), - o.LoadTestMetrics.AverageFulfillmentInMillions.String(), - o.LoadTestMetrics.SlowestFulfillment.String(), - o.LoadTestMetrics.P90FulfillmentBlockTime, - o.LoadTestMetrics.P95FulfillmentBlockTime, - o.LoadTestMetrics.FastestFulfillment.String(), - o.LoadTestMetrics.AverageResponseTimeInSecondsMillions.String(), - o.LoadTestMetrics.SlowestResponseTimeInSeconds.String(), - o.LoadTestMetrics.FastestResponseTimeInSeconds.String(), - *perfCfg.RPS, - perfCfg.RateLimitUnitDuration.String(), - *o.VRFv2PlusTestConfig.GetVRFv2PlusConfig().General.RandomnessRequestCountPerRequest, - *o.VRFv2PlusTestConfig.GetVRFv2PlusConfig().General.RandomnessRequestCountPerRequestDeviation, - ), - }) - - _, err := testreporters.SendSlackMessage(slackClient, slack.MsgOptionBlocks(messageBlocks...)) - if err != nil { - return err - } - return nil -} diff --git a/integration-tests/testsetups/automation_benchmark.go b/integration-tests/testsetups/automation_benchmark.go deleted file mode 100644 index b2b6ad03ba0..00000000000 --- a/integration-tests/testsetups/automation_benchmark.go +++ /dev/null @@ -1,777 +0,0 @@ -package testsetups - -import ( - "context" - "fmt" - "math" - "math/big" - "os" - "os/signal" - "strconv" - "sync/atomic" - "syscall" - "testing" - "time" - - "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - - "github.com/smartcontractkit/chainlink/integration-tests/actions/automationv2" - - geth "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/pkg/errors" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - "github.com/slack-go/slack" - "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" - - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - reportModel "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/ptr" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - autotestconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/automation" - "github.com/smartcontractkit/chainlink/integration-tests/testreporters" - tt "github.com/smartcontractkit/chainlink/integration-tests/types" -) - -// KeeperBenchmarkTest builds a test to check that chainlink nodes are able to upkeep a specified amount of Upkeep -// contracts within a certain block time -type KeeperBenchmarkTest struct { - Inputs KeeperBenchmarkTestInputs - TestReporter testreporters.KeeperBenchmarkTestReporter - - t *testing.T - log zerolog.Logger - startingBlock *big.Int - - automationTests []automationv2.AutomationTest - keeperRegistries []contracts.KeeperRegistry - keeperRegistrars []contracts.KeeperRegistrar - keeperConsumerContracts []contracts.AutomationConsumerBenchmark - upkeepIDs [][]*big.Int - - env *environment.Environment - namespace string - chainlinkNodes []*nodeclient.ChainlinkK8sClient - chainClient *seth.Client - testConfig tt.AutomationBenchmarkTestConfig - - linkToken contracts.LinkToken -} - -// UpkeepConfig dictates details of how the test's upkeep contracts should be called and configured -type UpkeepConfig struct { - NumberOfUpkeeps int // Number of upkeep contracts - BlockRange int64 // How many blocks to run the test for - BlockInterval int64 // Interval of blocks that upkeeps are expected to be performed - CheckGasToBurn int64 // How much gas should be burned on checkUpkeep() calls - PerformGasToBurn int64 // How much gas should be burned on performUpkeep() calls - UpkeepGasLimit int64 // Maximum gas that can be consumed by the upkeeps - FirstEligibleBuffer int64 // How many blocks to add to randomised first eligible block, set to 0 to disable randomised first eligible block -} - -// KeeperBenchmarkTestInputs are all the required inputs for a Keeper Benchmark Test -type KeeperBenchmarkTestInputs struct { - BlockchainClient *seth.Client // Client for the test to connect to the blockchain with - KeeperRegistrySettings *contracts.KeeperRegistrySettings // Settings of each keeper contract - Upkeeps *UpkeepConfig - Timeout time.Duration // Timeout for the test - ChainlinkNodeFunding *big.Float // Amount of ETH to fund each chainlink node with - UpkeepSLA int64 // SLA in number of blocks for an upkeep to be performed once it becomes eligible - RegistryVersions []ethereum.KeeperRegistryVersion // Registry version to use - ForceSingleTxnKey bool - BlockTime time.Duration - DeltaStage time.Duration - DeleteJobsOnEnd bool -} - -// NewKeeperBenchmarkTest prepares a new keeper benchmark test to be run -func NewKeeperBenchmarkTest(t *testing.T, inputs KeeperBenchmarkTestInputs) *KeeperBenchmarkTest { - return &KeeperBenchmarkTest{ - Inputs: inputs, - t: t, - log: logging.GetTestLogger(t), - } -} - -// Setup prepares contracts for the test -func (k *KeeperBenchmarkTest) Setup(env *environment.Environment, config testconfig.TestConfig) { - startTime := time.Now() - k.TestReporter.Summary.StartTime = startTime.UnixMilli() - k.ensureInputValues() - k.env = env - k.namespace = k.env.Cfg.Namespace - inputs := k.Inputs - k.testConfig = &config - - k.automationTests = make([]automationv2.AutomationTest, len(inputs.RegistryVersions)) - k.keeperRegistries = make([]contracts.KeeperRegistry, len(inputs.RegistryVersions)) - k.keeperRegistrars = make([]contracts.KeeperRegistrar, len(inputs.RegistryVersions)) - k.keeperConsumerContracts = make([]contracts.AutomationConsumerBenchmark, len(inputs.RegistryVersions)) - k.upkeepIDs = make([][]*big.Int, len(inputs.RegistryVersions)) - k.log.Debug().Interface("TestInputs", inputs).Msg("Setting up benchmark test") - - // if not present disable it - if k.testConfig.GetAutomationConfig().Resiliency == nil { - k.testConfig.GetAutomationConfig().Resiliency = &autotestconfig.ResiliencyConfig{ - ContractCallLimit: ptr.Ptr(uint(0)), - ContractCallInterval: ptr.Ptr(blockchain.StrDuration{Duration: 0 * time.Second}), - } - } - - var err error - // Connect to networks and prepare for contract deployment - k.chainlinkNodes, err = nodeclient.ConnectChainlinkNodes(k.env) - require.NoError(k.t, err, "Connecting to chainlink nodes shouldn't fail") - - if len(inputs.RegistryVersions) > 1 && !inputs.ForceSingleTxnKey { - for nodeIndex, node := range k.chainlinkNodes { - for registryIndex := 1; registryIndex < len(inputs.RegistryVersions); registryIndex++ { - k.log.Debug().Str("URL", node.URL()).Int("NodeIndex", nodeIndex).Int("RegistryIndex", registryIndex).Msg("Create Tx key") - _, _, err := node.CreateTxKey("evm", strconv.FormatInt(k.Inputs.BlockchainClient.ChainID, 10)) - require.NoError(k.t, err, "Creating transaction key shouldn't fail") - } - } - } - - for index := range inputs.RegistryVersions { - k.log.Info().Int("Index", index).Msg("Starting Test Setup") - a := automationv2.NewAutomationTestK8s(k.log, k.chainClient, k.chainlinkNodes, &config) - a.RegistrySettings = *k.Inputs.KeeperRegistrySettings - a.RegistrySettings.RegistryVersion = inputs.RegistryVersions[index] - a.RegistrarSettings = contracts.KeeperRegistrarSettings{ - AutoApproveConfigType: uint8(2), - AutoApproveMaxAllowed: math.MaxUint16, - MinLinkJuels: big.NewInt(0), - } - a.PluginConfig = actions.ReadPluginConfig(config) - a.PublicConfig = actions.ReadPublicConfig(config) - a.SetupAutomationDeploymentWithoutJobs(k.t) - err = a.SetConfigOnRegistry() - require.NoError(k.t, err, "Setting initial config on registry shouldn't fail") - k.SetupBenchmarkKeeperContracts(index, a) - } - - var keysToFund = inputs.RegistryVersions - if inputs.ForceSingleTxnKey { - keysToFund = inputs.RegistryVersions[0:1] - } - - for index := range keysToFund { - // Fund chainlink nodes - nodesToFund := k.chainlinkNodes - if inputs.RegistryVersions[index] >= ethereum.RegistryVersion_2_0 { - nodesToFund = k.chainlinkNodes[1:] - } - err = actions.FundChainlinkNodesAtKeyIndexFromRootAddress(k.log, k.chainClient, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(nodesToFund), k.Inputs.ChainlinkNodeFunding, index) - require.NoError(k.t, err, "Funding Chainlink nodes shouldn't fail") - } - - k.log.Info().Str("Setup Time", time.Since(startTime).String()).Msg("Finished Keeper Benchmark Test Setup") - err = k.SendSlackNotification(nil, &config) - if err != nil { - k.log.Warn().Msg("Sending test start slack notification failed") - } -} - -// Run runs the keeper benchmark test -func (k *KeeperBenchmarkTest) Run() { - u := k.Inputs.Upkeeps - k.TestReporter.Summary.Load.TotalCheckGasPerBlock = int64(u.NumberOfUpkeeps) * u.CheckGasToBurn - k.TestReporter.Summary.Load.TotalPerformGasPerBlock = int64((float64(u.NumberOfUpkeeps) / - float64(u.BlockInterval)) * float64(u.PerformGasToBurn)) - k.TestReporter.Summary.Load.AverageExpectedPerformsPerBlock = float64(u.NumberOfUpkeeps) / - float64(u.BlockInterval) - k.TestReporter.Summary.TestInputs = map[string]any{ - "NumberOfUpkeeps": u.NumberOfUpkeeps, - "CheckGasLimit": k.Inputs.KeeperRegistrySettings.CheckGasLimit, - "MaxPerformGas": k.Inputs.KeeperRegistrySettings.MaxPerformGas, - "CheckGasToBurn": u.CheckGasToBurn, - "PerformGasToBurn": u.PerformGasToBurn, - "BlockRange": u.BlockRange, - "BlockInterval": u.BlockInterval, - "UpkeepSLA": k.Inputs.UpkeepSLA, - "FirstEligibleBuffer": u.FirstEligibleBuffer, - "NumberOfRegistries": len(k.keeperRegistries), - } - inputs := k.Inputs - startingBlock, err := k.chainClient.Client.BlockNumber(testcontext.Get(k.t)) - require.NoError(k.t, err, "Error getting latest block number") - k.startingBlock = big.NewInt(0).SetUint64(startingBlock) - startTime := time.Now() - - for rIndex := range k.keeperRegistries { - var txKeyId = rIndex - if inputs.ForceSingleTxnKey { - txKeyId = 0 - } - k.automationTests[rIndex].SetTransmitterKeyIndex(txKeyId) - k.automationTests[rIndex].AddJobsAndSetConfig(k.t) - // Give time for OCR nodes to bootstrap - time.Sleep(1 * time.Minute) - } - - k.log.Info().Msgf("Waiting for %d blocks for all upkeeps to be performed", inputs.Upkeeps.BlockRange+inputs.UpkeepSLA) - - errgroup, errCtx := errgroup.WithContext(context.Background()) - - var startedObservations = atomic.Int32{} - var finishedObservations = atomic.Int32{} - - // since Seth can also be using simulated.Backend we need to make sure we are using ethclient.Client - sethAsEthClient, ok := k.chainClient.Client.(*ethclient.Client) - require.True(k.t, ok, "chainClient (Seth) client should be an ethclient.Client") - - // We create as many channels as listening goroutines (1 per upkeep). In the background we will be fanning out - // headers that we get from a single channel connected to EVM node to all upkeep-specific channels. - headerCh := make(chan *blockchain.SafeEVMHeader, 10) - sub, err := sethAsEthClient.Client().EthSubscribe(context.Background(), headerCh, "newHeads") - require.NoError(k.t, err, "Subscribing to new headers for upkeep observation shouldn't fail") - - totalNumberOfChannels := 0 - for rIndex := range k.keeperRegistries { - totalNumberOfChannels += len(k.upkeepIDs[rIndex]) - } - - contractChannels := make([]chan *blockchain.SafeEVMHeader, totalNumberOfChannels) - for idx := 0; idx < totalNumberOfChannels; idx++ { - contractChannels[idx] = make(chan *blockchain.SafeEVMHeader, 10) // Buffered just in case processing is slow - } - - // signals all goroutines to stop when subscription error occurs - stopAllGoroutinesCh := make(chan struct{}) - - // this goroutine fans out headers to goroutines in the background - // and exists when all goroutines are done or when an error occurs - go func() { - defer func() { - // close all fanning out channels at the very end - for _, ch := range contractChannels { - close(ch) - } - k.log.Debug().Msg("Closed header distribution channels") - }() - for { - select { - case header := <-headerCh: - k.log.Trace().Int64("Number", header.Number.Int64()).Msg("Fanning out new header") - for _, ch := range contractChannels { - ch <- header - } - // we don't really care if it was a success or an error, we just want to exit - // if it was an error, we will have an error in the main goroutine - case <-errCtx.Done(): - k.log.Debug().Msg("All goroutines finished.") - sub.Unsubscribe() - return - case err := <-sub.Err(): - // no need to unsubscribe, subscription errored - k.log.Error().Err(err).Msg("header subscription failed. Trying to reconnect...") - connectionLostAt := time.Now() - // we use infinite loop here on purposes, these nodes can be down for extended periods of time ¯\_(ツ)_/¯ - RECONNECT: - for { - sub, err = sethAsEthClient.Client().EthSubscribe(context.Background(), headerCh, "newHeads") - if err == nil { - break RECONNECT - } - - time.Sleep(5 * time.Second) - } - k.log.Info().Str("Reconnect Time", time.Since(connectionLostAt).String()).Msg("Reconnected to header subscription") - } - } - }() - - currentChannelIndex := 0 - for rIndex := range k.keeperRegistries { - for index, upkeepID := range k.upkeepIDs[rIndex] { - chIndex := currentChannelIndex - currentChannelIndex++ - upkeepIDCopy := upkeepID - registryIndex := rIndex - upkeepIndex := int64(index) - errgroup.Go(func() error { - startedObservations.Add(1) - k.log.Info().Int("Channel index", chIndex).Str("UpkeepID", upkeepIDCopy.String()).Msg("Starting upkeep observation") - - upKeepSLA := inputs.Upkeeps.BlockRange + inputs.UpkeepSLA - if upKeepSLA < 0 { - k.t.Fatalf("negative upkeep SLA: %d", upKeepSLA) - } - confirmer := contracts.NewAutomationConsumerBenchmarkUpkeepObserver( - k.keeperConsumerContracts[registryIndex], - k.keeperRegistries[registryIndex], - upkeepIDCopy, - uint64(upKeepSLA), - inputs.UpkeepSLA, - &k.TestReporter, - upkeepIndex, - inputs.Upkeeps.FirstEligibleBuffer, - k.log, - ) - - k.log.Debug().Str("UpkeepID", upkeepIDCopy.String()).Msg("Stared listening to new headers for upkeep observation") - - for { - select { - case <-stopAllGoroutinesCh: // header listening failed, exit - return errors.New("header distribution channel closed") - case <-errCtx.Done(): // one of goroutines errored, shut down gracefully, no need to return error - k.log.Error().Err(errCtx.Err()).Str("UpkeepID", upkeepIDCopy.String()).Msg("Stopping observations due to error in one of the goroutines") - return nil - case header := <-contractChannels[chIndex]: // new block, check if upkeep was performed - k.log.Trace().Interface("Header number", header.Number).Str("UpkeepID", upkeepIDCopy.String()).Msg("Started processing new header") - finished, headerErr := confirmer.ReceiveHeader(header) - if headerErr != nil { - k.log.Err(headerErr).Str("UpkeepID", upkeepIDCopy.String()).Msg("Error processing header") - return errors.Wrapf(headerErr, "error processing header for upkeep %s", upkeepIDCopy.String()) - } - - if finished { // observations should be completed as we are beyond block range, if there are not there's a bug in test code - finishedObservations.Add(1) - k.log.Info().Str("Done/Total", fmt.Sprintf("%d/%d", finishedObservations.Load(), startedObservations.Load())).Str("UpkeepID", upkeepIDCopy.String()).Msg("Upkeep observation completed") - - if confirmer.Complete() { - confirmer.LogDetails() - return nil - } - return fmt.Errorf("confimer has finished, but without completing observation, this should never happen. Review your code. UpkdeepID: %s", upkeepIDCopy.String()) - } - k.log.Trace().Interface("Header number", header.Number).Str("UpkeepID", upkeepIDCopy.String()).Msg("Finished processing new header") - } - } - }) - } - } - - if err := errgroup.Wait(); err != nil { - k.t.Fatalf("errored when waiting for upkeeps: %v", err) - } - - // Close header distribution channel once all observations are done - close(stopAllGoroutinesCh) - - // Main test loop - k.observeUpkeepEvents() - - // Collect logs for each registry to calculate test metrics - // This test generates a LOT of logs, and we need to break up our reads, or risk getting rate-limited by the node - var ( - endBlock = big.NewInt(0).Add(k.startingBlock, big.NewInt(u.BlockRange)) - registryLogs = make([][]types.Log, len(k.keeperRegistries)) - blockBatchSize int64 = 100 - ) - for rIndex := range k.keeperRegistries { - // Variables for the full registry - var ( - logs []types.Log - timeout = 5 * time.Second - addr = k.keeperRegistries[rIndex].Address() - queryStartBlock = big.NewInt(0).Set(k.startingBlock) - ) - - // Gather logs from the registry in 100 block chunks to avoid read limits - for queryStartBlock.Cmp(endBlock) < 0 { - filterQuery := geth.FilterQuery{ - Addresses: []common.Address{common.HexToAddress(addr)}, - FromBlock: queryStartBlock, - ToBlock: big.NewInt(0).Add(queryStartBlock, big.NewInt(blockBatchSize)), - } - - // This RPC call can possibly time out or otherwise die. Failure is not an option, keep retrying to get our stats. - err = errors.New("initial error") // to ensure our for loop runs at least once - for err != nil { - ctx, cancel := context.WithTimeout(testcontext.Get(k.t), timeout) - logs, err = k.chainClient.Client.FilterLogs(ctx, filterQuery) - cancel() - if err != nil { - k.log.Error(). - Err(err). - Interface("Filter Query", filterQuery). - Str("Timeout", timeout.String()). - Msg("Error getting logs from chain, trying again") - timeout = time.Duration(math.Min(float64(timeout)*2, float64(2*time.Minute))) - continue - } - k.log.Info(). - Uint64("From Block", queryStartBlock.Uint64()). - Uint64("To Block", filterQuery.ToBlock.Uint64()). - Int("Log Count", len(logs)). - Str("Registry Address", addr). - Msg("Collected logs") - queryStartBlock.Add(queryStartBlock, big.NewInt(blockBatchSize)) - registryLogs[rIndex] = append(registryLogs[rIndex], logs...) - } - } - } - - // Count reverts and stale upkeeps - for rIndex := range k.keeperRegistries { - contractABI := k.contractABI(rIndex) - for _, l := range registryLogs[rIndex] { - log := l - eventDetails, err := contractABI.EventByID(log.Topics[0]) - if err != nil { - k.log.Error().Err(err).Str("Log Hash", log.TxHash.Hex()).Msg("Error getting event details for log, report data inaccurate") - break - } - if eventDetails.Name == "UpkeepPerformed" { - parsedLog, err := k.keeperRegistries[rIndex].ParseUpkeepPerformedLog(&log) - if err != nil { - k.log.Error().Err(err).Str("Log Hash", log.TxHash.Hex()).Msg("Error parsing upkeep performed log, report data inaccurate") - break - } - if !parsedLog.Success { - k.TestReporter.NumRevertedUpkeeps++ - } - } else if eventDetails.Name == "StaleUpkeepReport" { - k.TestReporter.NumStaleUpkeepReports++ - } - } - } - - for _, chainlinkNode := range k.chainlinkNodes { - txData, err := chainlinkNode.MustReadTransactionAttempts() - if err != nil { - k.log.Error().Err(err).Msg("Error reading transaction attempts from Chainlink Node") - } - k.TestReporter.AttemptedChainlinkTransactions = append(k.TestReporter.AttemptedChainlinkTransactions, txData) - } - - k.TestReporter.Summary.Config.Chainlink, err = k.env.ResourcesSummary("app=chainlink-0") - if err != nil { - k.log.Error().Err(err).Msg("Error getting resource summary of chainlink node") - } - - k.TestReporter.Summary.Config.Geth, err = k.env.ResourcesSummary("app=geth") - if err != nil && k.Inputs.BlockchainClient.Cfg.IsSimulatedNetwork() { - k.log.Error().Err(err).Msg("Error getting resource summary of geth node") - } - - endTime := time.Now() - k.TestReporter.Summary.EndTime = endTime.UnixMilli() + (30 * time.Second.Milliseconds()) - - for rIndex := range k.keeperRegistries { - if inputs.DeleteJobsOnEnd { - // Delete keeper jobs on chainlink nodes - actions.DeleteKeeperJobsWithId(k.t, k.chainlinkNodes, rIndex+1) - } - } - - k.log.Info().Str("Run Time", endTime.Sub(startTime).String()).Msg("Finished Keeper Benchmark Test") -} - -// TearDownVals returns the networks that the test is running on -func (k *KeeperBenchmarkTest) TearDownVals(t *testing.T) ( - *testing.T, - *seth.Client, - string, - []*nodeclient.ChainlinkK8sClient, - reportModel.TestReporter, - reportModel.GrafanaURLProvider, -) { - return t, k.chainClient, k.namespace, k.chainlinkNodes, &k.TestReporter, k.testConfig -} - -// ********************* -// ****** Helpers ****** -// ********************* - -// observeUpkeepEvents subscribes to Upkeep events on deployed registries and logs them -// WARNING: This should only be used for observation and logging. This isn't a reliable way to build a final report -// due to how fragile subscriptions can be -func (k *KeeperBenchmarkTest) observeUpkeepEvents() { - eventLogs := make(chan types.Log) - registryAddresses := make([]common.Address, len(k.keeperRegistries)) - addressIndexMap := map[common.Address]int{} - for index, registry := range k.keeperRegistries { - registryAddresses[index] = common.HexToAddress(registry.Address()) - addressIndexMap[registryAddresses[index]] = index - } - filterQuery := geth.FilterQuery{ - Addresses: registryAddresses, - FromBlock: k.startingBlock, - } - - ctx, cancel := context.WithTimeout(testcontext.Get(k.t), 5*time.Second) - sub, err := k.chainClient.Client.SubscribeFilterLogs(ctx, filterQuery, eventLogs) - cancel() - require.NoError(k.t, err, "Subscribing to upkeep performed events log shouldn't fail") - - interruption := make(chan os.Signal, 1) - //nolint:staticcheck //ignore SA1016 we need to send the os.Kill signal - signal.Notify(interruption, os.Kill, os.Interrupt, syscall.SIGTERM) - - go func() { - for { - select { - case <-interruption: - k.log.Warn().Msg("Received interrupt signal, test container restarting. Dashboard view will be inaccurate.") - case err := <-sub.Err(): - backoff := time.Second - for err != nil { // Keep retrying until we get a successful subscription - k.log.Error(). - Err(err). - Interface("Query", filterQuery). - Str("Backoff", backoff.String()). - Msg("Error while subscribing to Keeper Event Logs. Resubscribing...") - - ctx, cancel := context.WithTimeout(testcontext.Get(k.t), backoff) - sub, err = k.chainClient.Client.SubscribeFilterLogs(ctx, filterQuery, eventLogs) - cancel() - if err != nil { - time.Sleep(backoff) - backoff = time.Duration(math.Min(float64(backoff)*2, float64(30*time.Second))) - } - } - log.Info().Msg("Resubscribed to Keeper Event Logs") - case vLog := <-eventLogs: - rIndex, ok := addressIndexMap[vLog.Address] - if !ok { - k.log.Error().Str("Address", vLog.Address.Hex()).Msg("Received log from unknown registry") - continue - } - contractABI := k.contractABI(rIndex) - eventDetails, err := contractABI.EventByID(vLog.Topics[0]) - require.NoError(k.t, err, "Getting event details for subscribed log shouldn't fail") - if eventDetails.Name != "UpkeepPerformed" && eventDetails.Name != "StaleUpkeepReport" { - // Skip non upkeepPerformed Logs - continue - } - if vLog.Removed { - k.log.Warn(). - Str("Name", eventDetails.Name). - Str("Registry", k.keeperRegistries[rIndex].Address()). - Msg("Got removed log") - } - switch eventDetails.Name { - case "UpkeepPerformed": - parsedLog, err := k.keeperRegistries[rIndex].ParseUpkeepPerformedLog(&vLog) - require.NoError(k.t, err, "Parsing upkeep performed log shouldn't fail") - - if parsedLog.Success { - k.log.Info(). - Str("Upkeep ID", parsedLog.Id.String()). - Bool("Success", parsedLog.Success). - Str("From", parsedLog.From.String()). - Str("Registry", k.keeperRegistries[rIndex].Address()). - Msg("Got successful Upkeep Performed log on Registry") - } else { - k.log.Warn(). - Str("Upkeep ID", parsedLog.Id.String()). - Bool("Success", parsedLog.Success). - Str("From", parsedLog.From.String()). - Str("Registry", k.keeperRegistries[rIndex].Address()). - Msg("Got reverted Upkeep Performed log on Registry") - } - case "StaleUpkeepReport": - parsedLog, err := k.keeperRegistries[rIndex].ParseStaleUpkeepReportLog(&vLog) - require.NoError(k.t, err, "Parsing stale upkeep report log shouldn't fail") - k.log.Warn(). - Str("Upkeep ID", parsedLog.Id.String()). - Str("Registry", k.keeperRegistries[rIndex].Address()). - Msg("Got stale Upkeep report log on Registry") - } - } - } - }() -} - -// contractABI returns the ABI of the proper keeper registry contract -func (k *KeeperBenchmarkTest) contractABI(rIndex int) *abi.ABI { - contractABI, err := contracts.GetRegistryContractABI(k.Inputs.RegistryVersions[rIndex]) - require.NoError(k.t, err, "Getting contract ABI shouldn't fail") - return contractABI -} - -// ensureValues ensures that all values needed to run the test are present -func (k *KeeperBenchmarkTest) ensureInputValues() { - inputs := k.Inputs - require.NotNil(k.t, inputs.BlockchainClient, "Need a valid blockchain client to use for the test") - k.chainClient = inputs.BlockchainClient - require.GreaterOrEqual(k.t, inputs.Upkeeps.NumberOfUpkeeps, 1, "Expecting at least 1 keeper contracts") - if inputs.Timeout == 0 { - require.Positive(k.t, inputs.Upkeeps.BlockRange, "If no `timeout` is provided, a `testBlockRange` is required") - } else if inputs.Upkeeps.BlockRange <= 0 { - require.GreaterOrEqual(k.t, inputs.Timeout, time.Second, "If no `testBlockRange` is provided a `timeout` is required") - } - require.NotNil(k.t, inputs.KeeperRegistrySettings, "You need to set KeeperRegistrySettings") - require.NotNil(k.t, k.Inputs.ChainlinkNodeFunding, "You need to set a funding amount for chainlink nodes") - clFunds, _ := k.Inputs.ChainlinkNodeFunding.Float64() - require.GreaterOrEqual(k.t, clFunds, 0.0, "Expecting Chainlink node funding to be more than 0 ETH") - require.Positive(k.t, inputs.Upkeeps.CheckGasToBurn, "You need to set an expected amount of gas to burn on checkUpkeep()") - require.GreaterOrEqual( - k.t, int64(inputs.KeeperRegistrySettings.CheckGasLimit), inputs.Upkeeps.CheckGasToBurn, "CheckGasLimit should be >= CheckGasToBurn", - ) - require.Positive(k.t, inputs.Upkeeps.PerformGasToBurn, "You need to set an expected amount of gas to burn on performUpkeep()") - require.NotNil(k.t, inputs.UpkeepSLA, "Expected UpkeepSLA to be set") - require.NotNil(k.t, inputs.Upkeeps.FirstEligibleBuffer, "You need to set FirstEligibleBuffer") - require.NotNil(k.t, inputs.RegistryVersions[0], "You need to set RegistryVersion") - require.NotNil(k.t, inputs.BlockTime, "You need to set BlockTime") - - if k.Inputs.DeltaStage == 0 { - k.Inputs.DeltaStage = k.Inputs.BlockTime * 5 - } -} - -func (k *KeeperBenchmarkTest) SendSlackNotification(slackClient *slack.Client, config tt.AutomationBenchmarkTestConfig) error { - if slackClient == nil { - slackClient = slack.New(reportModel.SlackAPIKey) - } - - grafanaUrl, err := config.GetGrafanaBaseURL() - if err != nil { - return err - } - - dashboardUrl, err := config.GetGrafanaDashboardURL() - if err != nil { - return err - } - - headerText := ":white_check_mark: Automation Benchmark Test STARTED :white_check_mark:" - formattedDashboardURL := fmt.Sprintf("%s%s?from=%d&to=%s&var-namespace=%s&var-cl_node=chainlink-0-0", grafanaUrl, dashboardUrl, k.TestReporter.Summary.StartTime, "now", k.env.Cfg.Namespace) - log.Info().Str("Dashboard", formattedDashboardURL).Msg("Dashboard URL") - - notificationBlocks := []slack.Block{} - notificationBlocks = append(notificationBlocks, - slack.NewHeaderBlock(slack.NewTextBlockObject("plain_text", headerText, true, false))) - notificationBlocks = append(notificationBlocks, - slack.NewContextBlock("context_block", slack.NewTextBlockObject("plain_text", k.env.Cfg.Namespace, false, false))) - notificationBlocks = append(notificationBlocks, slack.NewDividerBlock()) - notificationBlocks = append(notificationBlocks, slack.NewSectionBlock(slack.NewTextBlockObject("mrkdwn", - fmt.Sprintf("<%s|Test Dashboard> \nNotifying <@%s>", - formattedDashboardURL, reportModel.SlackUserID), false, true), nil, nil)) - - ts, err := reportModel.SendSlackMessage(slackClient, slack.MsgOptionBlocks(notificationBlocks...)) - log.Debug().Str("ts", ts).Msg("Sent Slack Message") - return err -} - -// SetupBenchmarkKeeperContracts deploys a set amount of keeper Benchmark contracts registered to a single registry -func (k *KeeperBenchmarkTest) SetupBenchmarkKeeperContracts(index int, a *automationv2.AutomationTest) { - registryVersion := k.Inputs.RegistryVersions[index] - k.Inputs.KeeperRegistrySettings.RegistryVersion = registryVersion - upkeep := k.Inputs.Upkeeps - var ( - err error - ) - - var consumer contracts.AutomationConsumerBenchmark - if a.TestConfig.GetAutomationConfig().UseExistingUpkeepContracts() { - benchmarkAddresses, err := a.TestConfig.GetAutomationConfig().UpkeepContractAddresses() - require.NoError(k.t, err, "Getting upkeep contract addresses shouldn't fail") - consumer, err = contracts.LoadAutomationConsumerBenchmark(k.chainClient, benchmarkAddresses[0]) - require.NoError(k.t, err, "Loading KeeperConsumerBenchmark shouldn't fail") - } else { - consumer = k.DeployKeeperConsumersBenchmark() - } - - var upkeepAddresses []string - - checkData := make([][]byte, 0) - uint256Ty, err := abi.NewType("uint256", "uint256", nil) - require.NoError(k.t, err) - var data []byte - checkDataAbi := abi.Arguments{ - { - Type: uint256Ty, - }, - { - Type: uint256Ty, - }, - { - Type: uint256Ty, - }, - { - Type: uint256Ty, - }, - { - Type: uint256Ty, - }, - { - Type: uint256Ty, - }, - } - - for i := 0; i < upkeep.NumberOfUpkeeps; i++ { - upkeepAddresses = append(upkeepAddresses, consumer.Address()) - // Compute check data - data, err = checkDataAbi.Pack( - big.NewInt(int64(i)), big.NewInt(upkeep.BlockInterval), big.NewInt(upkeep.BlockRange), - big.NewInt(upkeep.CheckGasToBurn), big.NewInt(upkeep.PerformGasToBurn), big.NewInt(upkeep.FirstEligibleBuffer)) - require.NoError(k.t, err) - k.log.Debug().Str("checkData: ", hexutil.Encode(data)).Int("id", i).Msg("checkData computed") - checkData = append(checkData, data) - } - linkFunds := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(upkeep.BlockRange/upkeep.BlockInterval)) - gasPrice := big.NewInt(0).Mul(k.Inputs.KeeperRegistrySettings.FallbackGasPrice, big.NewInt(2)) - minLinkBalance := big.NewInt(0). - Add(big.NewInt(0). - Mul(big.NewInt(0). - Div(big.NewInt(0).Mul(gasPrice, big.NewInt(upkeep.UpkeepGasLimit+80000)), k.Inputs.KeeperRegistrySettings.FallbackLinkPrice), - big.NewInt(1e18+0)), - big.NewInt(0)) - - linkFunds = big.NewInt(0).Add(linkFunds, minLinkBalance) - k.linkToken = a.LinkToken - - err = actions.SetupMultiCallAndFundDeploymentAddresses(k.chainClient, k.linkToken, upkeep.NumberOfUpkeeps, linkFunds, a.TestConfig) - require.NoError(k.t, err, "Sending link funds to deployment addresses shouldn't fail") - - if upkeep.UpkeepGasLimit < 0 || upkeep.UpkeepGasLimit > math.MaxUint32 { - k.t.Fatalf("upkeep gas limit overflows uint32: %d", upkeep.UpkeepGasLimit) - } - upkeepIds := actions.RegisterUpkeepContractsWithCheckData(k.t, k.chainClient, k.linkToken, linkFunds, uint32(upkeep.UpkeepGasLimit), a.Registry, a.Registrar, upkeep.NumberOfUpkeeps, upkeepAddresses, checkData, false, false, false, nil) - - k.automationTests[index] = *a - k.keeperRegistries[index] = a.Registry - k.keeperRegistrars[index] = a.Registrar - k.upkeepIDs[index] = upkeepIds - k.keeperConsumerContracts[index] = consumer -} - -func (k *KeeperBenchmarkTest) DeployKeeperConsumersBenchmark() contracts.AutomationConsumerBenchmark { - // Deploy consumer - var err error - var keeperConsumerInstance contracts.AutomationConsumerBenchmark - if *k.testConfig.GetAutomationConfig().Resiliency.ContractCallLimit != 0 && k.testConfig.GetAutomationConfig().Resiliency.ContractCallInterval.Duration != 0 { - maxRetryAttempts := *k.testConfig.GetAutomationConfig().Resiliency.ContractCallLimit - callRetryDelay := k.testConfig.GetAutomationConfig().Resiliency.ContractCallInterval.Duration - keeperConsumerInstance, err = contracts.DeployAutomationConsumerBenchmarkWithRetry(k.chainClient, k.log, maxRetryAttempts, callRetryDelay) - if err != nil { - k.log.Error().Err(err).Msg("Deploying AutomationConsumerBenchmark instance shouldn't fail") - keeperConsumerInstance, err = contracts.DeployAutomationConsumerBenchmarkWithRetry(k.chainClient, k.log, maxRetryAttempts, callRetryDelay) - require.NoError(k.t, err, "Error deploying AutomationConsumerBenchmark") - } - } else { - keeperConsumerInstance, err = contracts.DeployAutomationConsumerBenchmark(k.chainClient) - if err != nil { - k.log.Error().Err(err).Msg("Deploying AutomationConsumerBenchmark instance %d shouldn't fail") - keeperConsumerInstance, err = contracts.DeployAutomationConsumerBenchmark(k.chainClient) - require.NoError(k.t, err, "Error deploying AutomationConsumerBenchmark") - } - } - k.log.Debug(). - Str("Contract Address", keeperConsumerInstance.Address()). - Msg("Deployed Keeper Benchmark Contract") - - k.log.Info().Msg("Successfully deployed all Keeper Consumer Contracts") - - return keeperConsumerInstance -} diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go deleted file mode 100644 index b2c9b0554e8..00000000000 --- a/integration-tests/testsetups/ocr.go +++ /dev/null @@ -1,1321 +0,0 @@ -// Package testsetups compresses common test setups and more complicated setups like performance and chaos tests. -package testsetups - -import ( - "context" - "errors" - "fmt" - "math" - "math/big" - "math/rand" - "os" - "os/signal" - "sort" - "strconv" - "strings" - "sync" - "syscall" - "testing" - "time" - - geth "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" - "github.com/pelletier/go-toml/v2" - "github.com/rs/zerolog" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" - "github.com/smartcontractkit/libocr/gethwrappers2/ocr2aggregator" - - "github.com/smartcontractkit/chainlink-testing-framework/havoc" - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - ctf_client "github.com/smartcontractkit/chainlink-testing-framework/lib/client" - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - "github.com/smartcontractkit/chainlink-testing-framework/lib/grafana" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/chainlink" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/ethereum" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/foundry" - "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/mockserver" - mockservercfg "github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/mockserver-cfg" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" - reportModel "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - seth_utils "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/seth" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - "github.com/smartcontractkit/chainlink/integration-tests/testreporters" - tt "github.com/smartcontractkit/chainlink/integration-tests/types" -) - -const ( - saveFileLocation = "/persistence/ocr-soak-test-state.toml" - interruptedExitCode = 3 -) - -// OCRSoakTest defines a typical OCR soak test -type OCRSoakTest struct { - Config *tc.TestConfig - TestReporter testreporters.OCRSoakTestReporter - OperatorForwarderFlow bool - sethClient *seth.Client - OCRVersion string - - t *testing.T - startTime time.Time - timeLeft time.Duration - startingBlockNum uint64 - startingValue int - testEnvironment *environment.Environment - namespace string - log zerolog.Logger - bootstrapNode *nodeclient.ChainlinkK8sClient - workerNodes []*nodeclient.ChainlinkK8sClient - mockServer *ctf_client.MockserverClient - filterQuery geth.FilterQuery - - ocrRoundStates []*testreporters.OCRRoundState - testIssues []*testreporters.TestIssue - - ocrV1Instances []contracts.OffchainAggregator - ocrV1InstanceMap map[string]contracts.OffchainAggregator // address : instance - - ocrV2Instances []contracts.OffchainAggregatorV2 - ocrV2InstanceMap map[string]contracts.OffchainAggregatorV2 // address : instance - - linkContract *contracts.EthereumLinkToken - - rpcNetwork blockchain.EVMNetwork // network configuration for the blockchain node - reorgHappened bool // flag to indicate if a reorg happened during the test - gasSpikeSimulationHappened bool // flag to indicate if a gas spike simulation happened during the test - gasLimitSimulationHappened bool // flag to indicate if a gas limit simulation happened during the test - chaosList []*havoc.Chaos // list of chaos simulations to run during the test -} - -type OCRSoakTestOption = func(c *OCRSoakTest) - -func WithChaos(chaosList []*havoc.Chaos) OCRSoakTestOption { - return func(c *OCRSoakTest) { - c.chaosList = chaosList - } -} - -func WithNamespace(ns string) OCRSoakTestOption { - return func(c *OCRSoakTest) { - c.namespace = ns - } -} - -func WithForwarderFlow(forwarderFlow bool) OCRSoakTestOption { - return func(c *OCRSoakTest) { - c.OperatorForwarderFlow = forwarderFlow - } -} - -// NewOCRSoakTest creates a new OCR soak test to setup and run -func NewOCRSoakTest(t *testing.T, config *tc.TestConfig, opts ...OCRSoakTestOption) (*OCRSoakTest, error) { - test := &OCRSoakTest{ - Config: config, - TestReporter: testreporters.OCRSoakTestReporter{ - StartTime: time.Now(), - }, - t: t, - startTime: time.Now(), - timeLeft: config.GetActiveOCRConfig().Common.TestDuration.Duration, - log: logging.GetTestLogger(t), - ocrRoundStates: make([]*testreporters.OCRRoundState, 0), - ocrV1InstanceMap: make(map[string]contracts.OffchainAggregator), - ocrV2InstanceMap: make(map[string]contracts.OffchainAggregatorV2), - } - - ocrVersion := "1" - if config.OCR2 != nil { - ocrVersion = "2" - } - - test.TestReporter.OCRVersion = ocrVersion - test.OCRVersion = ocrVersion - - for _, opt := range opts { - opt(test) - } - t.Cleanup(func() { - test.deleteChaosSimulations() - }) - return test, test.ensureInputValues() -} - -// DeployEnvironment deploys the test environment, starting all Chainlink nodes and other components for the test -func (o *OCRSoakTest) DeployEnvironment(ocrTestConfig tt.OcrTestConfig) { - nodeNetwork := networks.MustGetSelectedNetworkConfig(ocrTestConfig.GetNetworkConfig())[0] // Environment currently being used to soak test on - - nsPre := fmt.Sprintf("soak-ocr-v%s-", o.OCRVersion) - if o.OperatorForwarderFlow { - nsPre = nsPre + "forwarder-" - } - - nsPre = fmt.Sprintf("%s%s", nsPre, strings.ReplaceAll(strings.ToLower(nodeNetwork.Name), " ", "-")) - nsPre = strings.ReplaceAll(nsPre, "_", "-") - - productName := fmt.Sprintf("data-feedsv%s.0", o.OCRVersion) - nsLabels, err := environment.GetRequiredChainLinkNamespaceLabels(productName, "soak") - require.NoError(o.t, err, "Error creating required chain.link labels for namespace") - - workloadPodLabels, err := environment.GetRequiredChainLinkWorkloadAndPodLabels(productName, "soak") - require.NoError(o.t, err, "Error creating required chain.link labels for workloads and pods") - - baseEnvironmentConfig := &environment.Config{ - TTL: time.Hour * 720, // 30 days, - NamespacePrefix: nsPre, - Test: o.t, - PreventPodEviction: true, - Labels: nsLabels, - WorkloadLabels: workloadPodLabels, - PodLabels: workloadPodLabels, - } - - testEnv := environment.New(baseEnvironmentConfig). - AddHelm(mockservercfg.New(nil)). - AddHelm(mockserver.New(nil)) - - var anvilChart *foundry.Chart - if nodeNetwork.Name == "Anvil" { - anvilConfig := ocrTestConfig.GetNetworkConfig().AnvilConfigs["ANVIL"] - anvilChart = foundry.New(&foundry.Props{ - Values: map[string]any{ - "fullnameOverride": "anvil", - "anvil": map[string]any{ - "chainId": strconv.FormatInt(nodeNetwork.ChainID, 10), - "blockTime": anvilConfig.BlockTime, - "forkURL": anvilConfig.URL, - "forkBlockNumber": anvilConfig.BlockNumber, - "forkRetries": anvilConfig.Retries, - "forkTimeout": anvilConfig.Timeout, - "forkComputeUnitsPerSecond": anvilConfig.ComputePerSecond, - "forkNoRateLimit": anvilConfig.RateLimitDisabled, - }, - "resources": map[string]any{ - "requests": map[string]any{ - "cpu": "4", - "memory": "6Gi", - }, - "limits": map[string]any{ - "cpu": "4", - "memory": "6Gi", - }, - }, - }, - }) - testEnv.AddHelm(anvilChart) - nodeNetwork.URLs = []string{anvilChart.ClusterWSURL} - nodeNetwork.HTTPURLs = []string{anvilChart.ClusterHTTPURL} - } else { - testEnv.AddHelm(ethereum.New(ðereum.Props{ - NetworkName: nodeNetwork.Name, - Simulated: nodeNetwork.Simulated, - WsURLs: nodeNetwork.URLs, - })) - } - - var overrideFn = func(_ any, target any) { - ctf_config.MustConfigOverrideChainlinkVersion(ocrTestConfig.GetChainlinkImageConfig(), target) - ctf_config.MightConfigOverridePyroscopeKey(ocrTestConfig.GetPyroscopeConfig(), target) - } - - tomlConfig, err := actions.BuildTOMLNodeConfigForK8s(ocrTestConfig, nodeNetwork) - require.NoError(o.t, err, "Error building TOML config for Chainlink nodes") - - cd := chainlink.NewWithOverride(0, map[string]any{ - "replicas": 6, - "toml": tomlConfig, - "db": map[string]any{ - "stateful": true, // stateful DB by default for soak tests - }, - "prometheus": true, - }, ocrTestConfig.GetChainlinkImageConfig(), overrideFn) - testEnv.AddHelm(cd) - - err = testEnv.Run() - require.NoError(o.t, err, "Error launching test environment") - o.testEnvironment = testEnv - o.namespace = testEnv.Cfg.Namespace - - // If the test is using the remote runner, we don't need to set the network URLs - // as the remote runner will handle that - if o.Environment().WillUseRemoteRunner() { - return - } - - o.rpcNetwork = nodeNetwork - if o.rpcNetwork.Simulated && o.rpcNetwork.Name == "Anvil" { - if testEnv.Cfg.InsideK8s { - // Test is running inside K8s, set the cluster URL of Anvil blockchain node - o.rpcNetwork.URLs = []string{anvilChart.ClusterWSURL} - } else { - // Test is running locally, set forwarded URL of Anvil blockchain node - o.rpcNetwork.URLs = []string{anvilChart.ForwardedWSURL} - o.rpcNetwork.HTTPURLs = []string{anvilChart.ForwardedHTTPURL} - } - } else if o.rpcNetwork.Simulated && o.rpcNetwork.Name == blockchain.SimulatedEVMNetwork.Name { - if testEnv.Cfg.InsideK8s { - // Test is running inside K8s - o.rpcNetwork.URLs = blockchain.SimulatedEVMNetwork.URLs - } else { - // Test is running locally, set forwarded URL of Geth blockchain node - wsURLs := o.testEnvironment.URLs[blockchain.SimulatedEVMNetwork.Name] - httpURLs := o.testEnvironment.URLs[blockchain.SimulatedEVMNetwork.Name+"_http"] - require.NotEmpty(o.t, wsURLs, "Forwarded Geth URLs should not be empty") - require.NotEmpty(o.t, httpURLs, "Forwarded Geth URLs should not be empty") - o.rpcNetwork.URLs = wsURLs - o.rpcNetwork.HTTPURLs = httpURLs - } - } -} - -// Environment returns the full K8s test environment -func (o *OCRSoakTest) Environment() *environment.Environment { - return o.testEnvironment -} - -// Setup initializes the OCR Soak Test by setting up clients, funding nodes, and deploying OCR contracts. -func (o *OCRSoakTest) Setup(ocrTestConfig tt.OcrTestConfig) { - o.initializeClients() - o.deployLinkTokenContract(ocrTestConfig) - o.fundChainlinkNodes() - - o.startingValue = 5 - - var forwarders []common.Address - if o.OperatorForwarderFlow { - _, forwarders = o.deployForwarderContracts() - } - - o.setupOCRContracts(ocrTestConfig, forwarders) - o.log.Info().Msg("OCR Soak Test Setup Complete") -} - -// initializeClients sets up the Seth client, Chainlink nodes, and mock server. -func (o *OCRSoakTest) initializeClients() { - sethClient, err := seth_utils.GetChainClient(o.Config, o.rpcNetwork) - require.NoError(o.t, err, "Error creating seth client") - o.sethClient = sethClient - - nodes, err := nodeclient.ConnectChainlinkNodes(o.testEnvironment) - require.NoError(o.t, err, "Connecting to chainlink nodes shouldn't fail") - o.bootstrapNode, o.workerNodes = nodes[0], nodes[1:] - - o.mockServer = ctf_client.ConnectMockServer(o.testEnvironment) - require.NoError(o.t, err, "Creating mockserver clients shouldn't fail") -} - -func (o *OCRSoakTest) deployLinkTokenContract(ocrTestConfig tt.OcrTestConfig) { - linkContract, err := actions.LinkTokenContract(o.log, o.sethClient, ocrTestConfig.GetActiveOCRConfig()) - require.NoError(o.t, err, "Error loading/deploying link token contract") - o.linkContract = linkContract -} - -// fundChainlinkNodes funds the Chainlink worker nodes. -func (o *OCRSoakTest) fundChainlinkNodes() { - o.log.Info().Float64("ETH amount per node", *o.Config.Common.ChainlinkNodeFunding).Msg("Funding Chainlink nodes") - err := actions.FundChainlinkNodesFromRootAddress(o.log, o.sethClient, contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(o.workerNodes), big.NewFloat(*o.Config.Common.ChainlinkNodeFunding)) - require.NoError(o.t, err, "Error funding Chainlink nodes") -} - -// deployForwarderContracts deploys forwarder contracts if OperatorForwarderFlow is enabled. -func (o *OCRSoakTest) deployForwarderContracts() (operators []common.Address, forwarders []common.Address) { - operators, forwarders, _ = actions.DeployForwarderContracts( - o.t, o.sethClient, common.HexToAddress(o.linkContract.Address()), len(o.workerNodes), - ) - require.Len(o.t, operators, len(o.workerNodes), "Number of operators should match number of nodes") - require.Len(o.t, forwarders, len(o.workerNodes), "Number of authorized forwarders should match number of nodes") - - forwarderNodesAddresses, err := actions.ChainlinkNodeAddresses(o.workerNodes) - require.NoError(o.t, err, "Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") - for i := range o.workerNodes { - actions.AcceptAuthorizedReceiversOperator(o.t, o.log, o.sethClient, operators[i], forwarders[i], []common.Address{forwarderNodesAddresses[i]}) - require.NoError(o.t, err, "Accepting Authorize Receivers on Operator shouldn't fail") - actions.TrackForwarder(o.t, o.sethClient, forwarders[i], o.workerNodes[i]) - } - return operators, forwarders -} - -// setupOCRContracts deploys and configures OCR contracts based on the version and forwarder flow. -func (o *OCRSoakTest) setupOCRContracts(ocrTestConfig tt.OcrTestConfig, forwarders []common.Address) { - switch o.OCRVersion { - case "1": - o.setupOCRv1Contracts(forwarders) - case "2": - o.setupOCRv2Contracts(ocrTestConfig, forwarders) - } -} - -// setupOCRv1Contracts deploys and configures OCRv1 contracts based on the forwarder flow. -func (o *OCRSoakTest) setupOCRv1Contracts(forwarders []common.Address) { - var err error - if o.OperatorForwarderFlow { - o.ocrV1Instances, err = actions.DeployOCRContractsForwarderFlow( - o.log, - o.sethClient, - o.Config.GetActiveOCRConfig(), - common.HexToAddress(o.linkContract.Address()), - contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(o.workerNodes), - forwarders, - ) - require.NoError(o.t, err, "Error deploying OCR Forwarder contracts") - o.createJobsWithForwarder() - } else { - o.ocrV1Instances, err = actions.SetupOCRv1Contracts( - o.log, - o.sethClient, - o.Config.GetActiveOCRConfig(), - common.HexToAddress(o.linkContract.Address()), - contracts.ChainlinkK8sClientToChainlinkNodeWithKeysAndAddress(o.workerNodes), - ) - require.NoError(o.t, err, "Error setting up OCRv1 contracts") - err = o.createOCRv1Jobs() - require.NoError(o.t, err, "Error creating OCR jobs") - } - - o.storeOCRInstancesV1() -} - -// setupOCRv2Contracts sets up and configures OCRv2 contracts. -func (o *OCRSoakTest) setupOCRv2Contracts(ocrTestConfig tt.OcrTestConfig, forwarders []common.Address) { - var err error - var transmitters []string - if o.OperatorForwarderFlow { - for _, forwarder := range forwarders { - transmitters = append(transmitters, forwarder.Hex()) - } - } else { - for _, node := range o.workerNodes { - nodeAddress, err := node.PrimaryEthAddress() - require.NoError(o.t, err, "Error getting node's primary ETH address") - transmitters = append(transmitters, nodeAddress) - } - } - - ocrOffchainOptions := contracts.DefaultOffChainAggregatorOptions() - o.ocrV2Instances, err = actions.SetupOCRv2Contracts( - o.log, o.sethClient, ocrTestConfig.GetActiveOCRConfig(), common.HexToAddress(o.linkContract.Address()), transmitters, ocrOffchainOptions, - ) - require.NoError(o.t, err, "Error deploying OCRv2 contracts") - err = o.createOCRv2Jobs() - require.NoError(o.t, err, "Error creating OCR jobs") - if !ocrTestConfig.GetActiveOCRConfig().UseExistingOffChainAggregatorsContracts() || (ocrTestConfig.GetActiveOCRConfig().UseExistingOffChainAggregatorsContracts() && ocrTestConfig.GetActiveOCRConfig().ConfigureExistingOffChainAggregatorsContracts()) { - contractConfig, err := actions.BuildMedianOCR2Config(o.workerNodes, ocrOffchainOptions) - require.NoError(o.t, err, "Error building median config") - err = actions.ConfigureOCRv2AggregatorContracts(contractConfig, o.ocrV2Instances) - require.NoError(o.t, err, "Error configuring OCRv2 aggregator contracts") - } - o.storeOCRInstancesV2() -} - -// storeOCRInstancesV1 stores OCRv1 contract instances by their addresses. -func (o *OCRSoakTest) storeOCRInstancesV1() { - for _, ocrInstance := range o.ocrV1Instances { - o.ocrV1InstanceMap[ocrInstance.Address()] = ocrInstance - } -} - -// storeOCRInstancesV2 stores OCRv2 contract instances by their addresses. -func (o *OCRSoakTest) storeOCRInstancesV2() { - for _, ocrInstance := range o.ocrV2Instances { - o.ocrV2InstanceMap[ocrInstance.Address()] = ocrInstance - } -} - -// Run starts the OCR soak test -func (o *OCRSoakTest) Run() { - config, err := tc.GetConfig([]string{"soak"}, tc.OCR) - require.NoError(o.t, err, "Error getting config") - - ctx, cancel := context.WithTimeout(testcontext.Get(o.t), time.Second*5) - latestBlockNum, err := o.sethClient.Client.BlockNumber(ctx) - cancel() - require.NoError(o.t, err, "Error getting current block number") - o.startingBlockNum = latestBlockNum - - o.log.Info(). - Str("Test Duration", o.Config.GetActiveOCRConfig().Common.TestDuration.Duration.Truncate(time.Second).String()). - Int("Number of OCR Contracts", *config.GetActiveOCRConfig().Common.NumberOfContracts). - Str("OCR Version", o.OCRVersion). - Msg("Starting OCR Soak Test") - - o.testLoop(o.Config.GetActiveOCRConfig().Common.TestDuration.Duration, o.startingValue) - o.complete() -} - -// createJobsWithForwarder creates OCR jobs with the forwarder setup. -func (o *OCRSoakTest) createJobsWithForwarder() { - actions.CreateOCRJobsWithForwarder(o.t, o.ocrV1Instances, o.bootstrapNode, o.workerNodes, o.startingValue, o.mockServer, o.sethClient.ChainID) -} - -// createOCRv1Jobs creates OCRv1 jobs. -func (o *OCRSoakTest) createOCRv1Jobs() error { - ctx, cancel := context.WithTimeout(testcontext.Get(o.t), time.Second*5) - defer cancel() - - chainId, err := o.sethClient.Client.ChainID(ctx) - if err != nil { - return fmt.Errorf("error getting chain ID: %w", err) - } - - err = actions.CreateOCRJobs(o.ocrV1Instances, o.bootstrapNode, o.workerNodes, o.startingValue, o.mockServer, chainId.String()) - if err != nil { - return fmt.Errorf("error creating OCRv1 jobs: %w", err) - } - return nil -} - -// createOCRv2Jobs creates OCRv2 jobs. -func (o *OCRSoakTest) createOCRv2Jobs() error { - err := actions.CreateOCRv2Jobs(o.ocrV2Instances, o.bootstrapNode, o.workerNodes, o.mockServer, o.startingValue, o.sethClient.ChainID, o.OperatorForwarderFlow, o.log) - if err != nil { - return fmt.Errorf("error creating OCRv2 jobs: %w", err) - } - return nil -} - -// Networks returns the networks that the test is running on -func (o *OCRSoakTest) TearDownVals(t *testing.T) ( - *testing.T, - *seth.Client, - string, - []*nodeclient.ChainlinkK8sClient, - reportModel.TestReporter, - reportModel.GrafanaURLProvider, -) { - return t, o.sethClient, o.namespace, append(o.workerNodes, o.bootstrapNode), &o.TestReporter, o.Config -} - -// ********************* -// Recovery if the test is shut-down/rebalanced by K8s -// ********************* - -// OCRSoakTestState contains all the info needed by the test to recover from a K8s rebalance, assuming the test was in a running state -type OCRSoakTestState struct { - Namespace string `toml:"namespace"` - OCRRoundStates []*testreporters.OCRRoundState `toml:"ocrRoundStates"` - TestIssues []*testreporters.TestIssue `toml:"testIssues"` - StartingBlockNum uint64 `toml:"startingBlockNum"` - StartTime time.Time `toml:"startTime"` - TimeRunning time.Duration `toml:"timeRunning"` - TestDuration time.Duration `toml:"testDuration"` - OCRContractAddresses []string `toml:"ocrContractAddresses"` - OCRVersion string `toml:"ocrVersion"` - - BootStrapNodeURL string `toml:"bootstrapNodeURL"` - WorkerNodeURLs []string `toml:"workerNodeURLs"` - ChainURL string `toml:"chainURL"` - ReorgHappened bool `toml:"reorgHappened"` - MockServerURL string `toml:"mockServerURL"` -} - -// SaveState saves the current state of the test to a TOML file -func (o *OCRSoakTest) SaveState() error { - ocrAddresses := o.getContractAddressesString() - workerNodeURLs := make([]string, len(o.workerNodes)) - for i, workerNode := range o.workerNodes { - workerNodeURLs[i] = workerNode.URL() - } - - testState := &OCRSoakTestState{ - Namespace: o.namespace, - OCRRoundStates: o.ocrRoundStates, - TestIssues: o.testIssues, - StartingBlockNum: o.startingBlockNum, - StartTime: o.startTime, - TimeRunning: time.Since(o.startTime), - TestDuration: o.Config.GetActiveOCRConfig().Common.TestDuration.Duration, - OCRContractAddresses: ocrAddresses, - OCRVersion: o.OCRVersion, - - MockServerURL: "http://mockserver:1080", // TODO: Make this dynamic - BootStrapNodeURL: o.bootstrapNode.URL(), - WorkerNodeURLs: workerNodeURLs, - ReorgHappened: o.reorgHappened, - } - data, err := toml.Marshal(testState) - if err != nil { - return err - } - //nolint:gosec // G306 - let everyone read - if err = os.WriteFile(saveFileLocation, data, 0644); err != nil { - return err - } - fmt.Println("---Saved State---") - fmt.Println(saveFileLocation) - fmt.Println("-----------------") - fmt.Println(string(data)) - fmt.Println("-----------------") - return nil -} - -// LoadState loads the test state from a TOML file -func (o *OCRSoakTest) LoadState() error { - if !o.Interrupted() { - return fmt.Errorf("no save file found at '%s'", saveFileLocation) - } - - testState := &OCRSoakTestState{} - saveData, err := os.ReadFile(saveFileLocation) - if err != nil { - return err - } - err = toml.Unmarshal(saveData, testState) - if err != nil { - return err - } - fmt.Println("---Loaded State---") - fmt.Println(saveFileLocation) - fmt.Println("------------------") - fmt.Println(string(saveData)) - fmt.Println("------------------") - - o.namespace = testState.Namespace - o.TestReporter = testreporters.OCRSoakTestReporter{ - OCRVersion: testState.OCRVersion, - StartTime: testState.StartTime, - } - duration := blockchain.StrDuration{Duration: testState.TestDuration} - o.ocrRoundStates = testState.OCRRoundStates - o.testIssues = testState.TestIssues - o.Config.GetActiveOCRConfig().Common.TestDuration = &duration - o.timeLeft = testState.TestDuration - testState.TimeRunning - o.startTime = testState.StartTime - o.startingBlockNum = testState.StartingBlockNum - o.reorgHappened = testState.ReorgHappened - o.OCRVersion = testState.OCRVersion - - o.bootstrapNode, err = nodeclient.ConnectChainlinkNodeURL(testState.BootStrapNodeURL) - if err != nil { - return err - } - o.workerNodes, err = nodeclient.ConnectChainlinkNodeURLs(testState.WorkerNodeURLs) - if err != nil { - return err - } - - switch testState.OCRVersion { - case "1": - o.ocrV1Instances = make([]contracts.OffchainAggregator, len(testState.OCRContractAddresses)) - for i, addr := range testState.OCRContractAddresses { - instance, err := contracts.LoadOffChainAggregator(o.log, o.sethClient, common.HexToAddress(addr)) - if err != nil { - return fmt.Errorf("failed to instantiate OCR instance: %w", err) - } - o.ocrV1Instances[i] = &instance - } - case "2": - o.ocrV2Instances = make([]contracts.OffchainAggregatorV2, len(testState.OCRContractAddresses)) - for i, addr := range testState.OCRContractAddresses { - instance, err := contracts.LoadOffchainAggregatorV2(o.log, o.sethClient, common.HexToAddress(addr)) - if err != nil { - return err - } - o.ocrV2Instances[i] = &instance - } - } - - o.mockServer = ctf_client.ConnectMockServerURL(testState.MockServerURL) - return err -} - -func (o *OCRSoakTest) Resume() { - o.testIssues = append(o.testIssues, &testreporters.TestIssue{ - StartTime: time.Now(), - Message: "Test Resumed", - }) - o.log.Info(). - Str("Total Duration", o.Config.GetActiveOCRConfig().Common.TestDuration.String()). - Str("Time Left", o.timeLeft.String()). - Msg("Resuming OCR Soak Test") - - ocrAddresses := make([]common.Address, *o.Config.GetActiveOCRConfig().Common.NumberOfContracts) - - switch o.OCRVersion { - case "1": - for i, ocrInstance := range o.ocrV1Instances { - ocrAddresses[i] = common.HexToAddress(ocrInstance.Address()) - } - contractABI, err := offchainaggregator.OffchainAggregatorMetaData.GetAbi() - require.NoError(o.t, err, "Error retrieving OCR contract ABI") - o.filterQuery = geth.FilterQuery{ - Addresses: ocrAddresses, - Topics: [][]common.Hash{{contractABI.Events["AnswerUpdated"].ID}}, - FromBlock: big.NewInt(0).SetUint64(o.startingBlockNum), - } - case "2": - for i, ocrInstance := range o.ocrV2Instances { - ocrAddresses[i] = common.HexToAddress(ocrInstance.Address()) - } - contractABI, err := ocr2aggregator.AggregatorInterfaceMetaData.GetAbi() - require.NoError(o.t, err, "Error retrieving OCR contract ABI") - o.filterQuery = geth.FilterQuery{ - Addresses: ocrAddresses, - Topics: [][]common.Hash{{contractABI.Events["AnswerUpdated"].ID}}, - FromBlock: big.NewInt(0).SetUint64(o.startingBlockNum), - } - } - - startingValue := 5 - o.testLoop(o.timeLeft, startingValue) - - o.log.Info().Msg("Test Complete, collecting on-chain events") - - err := o.collectEvents() - o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") - o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) -} - -// Interrupted indicates whether the test was interrupted by something like a K8s rebalance or not -func (o *OCRSoakTest) Interrupted() bool { - _, err := os.Stat(saveFileLocation) - return err == nil -} - -// ********************* -// ****** Helpers ****** -// ********************* - -// testLoop is the primary test loop that will trigger new rounds and watch events -func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { - endTest := time.After(testDuration) - interruption := make(chan os.Signal, 1) - //nolint:staticcheck //ignore SA1016 we need to send the os.Kill signal - signal.Notify(interruption, os.Kill, os.Interrupt, syscall.SIGTERM) - - ctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - // Channel to signal polling to reset round event counter - resetEventCounter := make(chan struct{}) - defer close(resetEventCounter) - - lastValue := 0 - newRoundTrigger := time.NewTimer(0) // Want to trigger a new round ASAP - defer newRoundTrigger.Stop() - o.setFilterQuery() - wg.Add(1) - go o.pollingOCREvents(ctx, &wg, resetEventCounter) - - n := o.Config.GetNetworkConfig() - - // Schedule blockchain re-org if needed - // Reorg only available for Simulated Geth - if n.IsSimulatedGethSelected() && n.GethReorgConfig.Enabled { - var reorgDelay time.Duration - if n.GethReorgConfig.DelayCreate.Duration > testDuration { - // This may happen when test is resumed and the reorg delay is longer than the time left - o.log.Warn().Msg("Reorg delay is longer than test duration, reorg scheduled immediately") - reorgDelay = 0 - } else { - reorgDelay = n.GethReorgConfig.DelayCreate.Duration - } - time.AfterFunc(reorgDelay, func() { - if !o.reorgHappened { - o.startGethBlockchainReorg(o.rpcNetwork, n.GethReorgConfig) - } - }) - } - - // Schedule gas simulations if needed - // Gas simulation only available for Anvil - if o.rpcNetwork.Name == "Anvil" { - ac := o.Config.GetNetworkConfig().AnvilConfigs["ANVIL"] - if ac != nil && ac.GasSpikeSimulation.Enabled { - var delay time.Duration - if ac.GasSpikeSimulation.DelayCreate.Duration > testDuration { - // This may happen when test is resumed and the reorg delay is longer than the time left - o.log.Warn().Msg("Gas spike simulation delay is longer than test duration, gas simulation scheduled immediately") - delay = 0 - } else { - delay = ac.GasSpikeSimulation.DelayCreate.Duration - } - time.AfterFunc(delay, func() { - if !o.gasSpikeSimulationHappened { - o.startAnvilGasSpikeSimulation(o.rpcNetwork, ac.GasSpikeSimulation) - } - }) - } - if ac != nil && ac.GasLimitSimulation.Enabled { - var delay time.Duration - if ac.GasLimitSimulation.DelayCreate.Duration > testDuration { - // This may happen when test is resumed and the reorg delay is longer than the time left - o.log.Warn().Msg("Gas limit simulation delay is longer than test duration, gas simulation scheduled immediately") - delay = 0 - } else { - delay = ac.GasLimitSimulation.DelayCreate.Duration - } - time.AfterFunc(delay, func() { - if !o.gasLimitSimulationHappened { - o.startAnvilGasLimitSimulation(o.rpcNetwork, ac.GasLimitSimulation) - } - }) - } - } - - // Schedule chaos simulations if needed - if len(o.chaosList) > 0 { - for _, chaos := range o.chaosList { - chaos.Create(context.Background()) - chaos.AddListener(havoc.NewChaosLogger(o.log)) - chaos.AddListener(ocrTestChaosListener{t: o.t}) - // Add Grafana annotation if configured - if o.Config.Logging.Grafana != nil && o.Config.Logging.Grafana.BaseUrl != nil && o.Config.Logging.Grafana.BearerToken != nil && o.Config.Logging.Grafana.DashboardUID != nil { - chaos.AddListener(havoc.NewSingleLineGrafanaAnnotator(*o.Config.Logging.Grafana.BaseUrl, *o.Config.Logging.Grafana.BearerToken, *o.Config.Logging.Grafana.DashboardUID, o.log)) - } else { - o.log.Warn().Msg("Skipping Grafana annotation for chaos simulation. Grafana config is missing either BearerToken, BaseUrl or DashboardUID") - } - } - } - - for { - select { - case <-interruption: - saveStart := time.Now() - o.log.Warn().Msg("Test interrupted, saving state before shut down") - o.testIssues = append(o.testIssues, &testreporters.TestIssue{ - StartTime: time.Now(), - Message: "Test Interrupted", - }) - if err := o.SaveState(); err != nil { - o.log.Error().Err(err).Msg("Error saving state") - } - o.log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state") - o.deleteChaosSimulations() - os.Exit(interruptedExitCode) // Exit with interrupted code to indicate test was interrupted, not just a normal failure - case <-endTest: - cancel() - wg.Wait() // Wait for polling to complete - return - case <-newRoundTrigger.C: - err := o.triggerNewRound(newValue) - timerReset := o.Config.GetActiveOCRConfig().Soak.TimeBetweenRounds.Duration - if err != nil { - timerReset = time.Second * 5 - o.log.Error().Err(err). - Str("Waiting", timerReset.String()). - Msg("Error triggering new round, waiting and trying again. Possible connection issues with mockserver") - } - // Signal polling to reset event counter - resetEventCounter <- struct{}{} - newRoundTrigger.Reset(timerReset) - - // Change value for the next round - newValue = rand.Intn(256) + 1 // #nosec G404 - not everything needs to be cryptographically secure - for newValue == lastValue { - newValue = rand.Intn(256) + 1 // #nosec G404 - kudos to you if you actually find a way to exploit this - } - lastValue = newValue - } - } -} - -// completes the test -func (o *OCRSoakTest) complete() { - o.log.Info().Msg("Test Complete, collecting on-chain events") - - err := o.collectEvents() - if err != nil { - o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") - } - o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) -} - -func (o *OCRSoakTest) startGethBlockchainReorg(network blockchain.EVMNetwork, conf ctf_config.ReorgConfig) { - client := ctf_client.NewRPCClient(network.HTTPURLs[0], nil) - o.log.Info(). - Str("URL", client.URL). - Int("Depth", conf.Depth). - Msg("Starting blockchain reorg on Simulated Geth chain") - o.postGrafanaAnnotation(fmt.Sprintf("Starting blockchain reorg on Simulated Geth chain with depth %d", conf.Depth), nil) - err := client.GethSetHead(conf.Depth) - require.NoError(o.t, err, "Error starting blockchain reorg on Simulated Geth chain") - o.reorgHappened = true -} - -func (o *OCRSoakTest) startAnvilGasSpikeSimulation(network blockchain.EVMNetwork, conf ctf_config.GasSpikeSimulationConfig) { - client := ctf_client.NewRPCClient(network.HTTPURLs[0], nil) - o.log.Info(). - Str("URL", client.URL). - Any("GasSpikeSimulationConfig", conf). - Msg("Starting gas spike simulation on Anvil chain") - o.postGrafanaAnnotation(fmt.Sprintf("Starting gas spike simulation on Anvil chain. Config: %+v", conf), nil) - err := client.ModulateBaseFeeOverDuration(o.log, conf.StartGasPrice, conf.GasRisePercentage, conf.Duration.Duration, conf.GasSpike) - o.postGrafanaAnnotation(fmt.Sprintf("Gas spike simulation ended. Config: %+v", conf), nil) - require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") - o.gasSpikeSimulationHappened = true -} - -func (o *OCRSoakTest) startAnvilGasLimitSimulation(network blockchain.EVMNetwork, conf ctf_config.GasLimitSimulationConfig) { - client := ctf_client.NewRPCClient(network.HTTPURLs[0], nil) - latestBlock, err := o.sethClient.Client.BlockByNumber(context.Background(), nil) - require.NoError(o.t, err) - newGasLimit := int64(math.Ceil(float64(latestBlock.GasUsed()) * conf.NextGasLimitPercentage)) - o.log.Info(). - Str("URL", client.URL). - Any("GasLimitSimulationConfig", conf). - Uint64("LatestBlock", latestBlock.Number().Uint64()). - Uint64("LatestGasUsed", latestBlock.GasUsed()). - Uint64("LatestGasLimit", latestBlock.GasLimit()). - Int64("NewGasLimit", newGasLimit). - Msg("Starting gas limit simulation on Anvil chain") - o.postGrafanaAnnotation(fmt.Sprintf("Starting gas limit simulation on Anvil chain. Config: %+v", conf), nil) - err = client.AnvilSetBlockGasLimit([]any{newGasLimit}) - require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") - time.Sleep(conf.Duration.Duration) - o.log.Info(). - Str("URL", client.URL). - Any("GasLimitSimulationConfig", conf). - Uint64("LatestGasLimit", latestBlock.GasLimit()). - Msg("Returning to old gas limit simulation on Anvil chain") - o.postGrafanaAnnotation(fmt.Sprintf("Returning to old gas limit simulation on Anvil chain. Config: %+v", conf), nil) - err = client.AnvilSetBlockGasLimit([]any{latestBlock.GasLimit()}) - require.NoError(o.t, err, "Error starting gas simulation on Anvil chain") - o.gasLimitSimulationHappened = true -} - -// Delete k8s chaos objects it any of them still exist -// This is needed to clean up the chaos objects if the test is interrupted or it finishes -func (o *OCRSoakTest) deleteChaosSimulations() { - for _, chaos := range o.chaosList { - err := chaos.Delete(context.Background()) - // Check if the error is because the chaos object is already deleted - if err != nil && !strings.Contains(err.Error(), "not found") { - o.log.Error().Err(err).Msg("Error deleting chaos object") - } - } -} - -// setFilterQuery to look for all events that happened -func (o *OCRSoakTest) setFilterQuery() { - ocrAddresses := o.getContractAddresses() - contractABI, err := offchainaggregator.OffchainAggregatorMetaData.GetAbi() - require.NoError(o.t, err, "Error retrieving OCR contract ABI") - o.filterQuery = geth.FilterQuery{ - Addresses: ocrAddresses, - Topics: [][]common.Hash{{contractABI.Events["AnswerUpdated"].ID}}, - FromBlock: big.NewInt(0).SetUint64(o.startingBlockNum), - } - o.log.Debug(). - Interface("Addresses", ocrAddresses). - Str("Topic", contractABI.Events["AnswerUpdated"].ID.Hex()). - Uint64("Starting Block", o.startingBlockNum). - Msg("Filter Query Set") -} - -// pollingOCREvents Polls the blocks for OCR events and logs them to the test logger -func (o *OCRSoakTest) pollingOCREvents(ctx context.Context, wg *sync.WaitGroup, resetEventCounter <-chan struct{}) { - defer wg.Done() - // Keep track of the last processed block number - processedBlockNum := o.startingBlockNum - 1 - // TODO: Make this configurable - pollInterval := time.Second * 30 - ticker := time.NewTicker(pollInterval) - defer ticker.Stop() - - // Retrieve expected number of events per round from configuration - expectedEventsPerRound := *o.Config.GetActiveOCRConfig().Common.NumberOfContracts - eventCounter := 0 - roundTimeout := o.Config.GetActiveOCRConfig().Soak.TimeBetweenRounds.Duration - timeoutTimer := time.NewTimer(roundTimeout) - round := 0 - defer timeoutTimer.Stop() - - o.log.Info().Msg("Start Polling for Answer Updated Events") - - for { - select { - case <-resetEventCounter: - if round != 0 { - if eventCounter == expectedEventsPerRound { - o.log.Info(). - Int("Events found", eventCounter). - Int("Events Expected", expectedEventsPerRound). - Msg("All expected events found") - } else if eventCounter < expectedEventsPerRound { - o.log.Warn(). - Int("Events found", eventCounter). - Int("Events Expected", expectedEventsPerRound). - Msg("Expected to find more events") - } - } - // Reset event counter and timer for new round - eventCounter = 0 - // Safely stop and drain the timer if a value is present - if !timeoutTimer.Stop() { - <-timeoutTimer.C - } - timeoutTimer.Reset(roundTimeout) - o.log.Info().Msg("Polling for new round, event counter reset") - round++ - case <-ctx.Done(): - o.log.Info().Msg("Test duration ended, finalizing event polling") - timeoutTimer.Reset(roundTimeout) - // Wait until expected events are fetched or until timeout - for eventCounter < expectedEventsPerRound { - select { - case <-timeoutTimer.C: - o.log.Warn().Msg("Timeout reached while waiting for final events") - return - case <-ticker.C: - o.fetchAndProcessEvents(&eventCounter, expectedEventsPerRound, &processedBlockNum) - } - } - o.log.Info(). - Int("Events found", eventCounter). - Int("Events Expected", expectedEventsPerRound). - Msg("Stop polling.") - return - case <-ticker.C: - o.fetchAndProcessEvents(&eventCounter, expectedEventsPerRound, &processedBlockNum) - } - } -} - -// Helper function to poll events and update eventCounter -func (o *OCRSoakTest) fetchAndProcessEvents(eventCounter *int, expectedEvents int, processedBlockNum *uint64) { - latestBlock, err := o.sethClient.Client.BlockNumber(context.Background()) - if err != nil { - o.log.Error().Err(err).Msg("Error getting latest block number") - return - } - - if *processedBlockNum == latestBlock { - o.log.Debug(). - Uint64("Latest Block", latestBlock). - Uint64("Last Processed Block Number", *processedBlockNum). - Msg("No new blocks since last poll") - return - } - - // Check if the latest block is behind processedBlockNum due to possible reorgs - if *processedBlockNum > latestBlock { - o.log.Error(). - Uint64("From Block", *processedBlockNum). - Uint64("To Block", latestBlock). - Msg("The latest block is behind the processed block. This could happen due to RPC issues or possibly a reorg") - *processedBlockNum = latestBlock - return - } - - fromBlock := *processedBlockNum + 1 - o.filterQuery.FromBlock = big.NewInt(0).SetUint64(fromBlock) - o.filterQuery.ToBlock = big.NewInt(0).SetUint64(latestBlock) - - o.log.Debug(). - Uint64("From Block", fromBlock). - Uint64("To Block", latestBlock). - Msg("Fetching logs for the specified range") - - logs, err := o.sethClient.Client.FilterLogs(context.Background(), o.filterQuery) - if err != nil { - o.log.Error().Err(err).Msg("Error fetching logs") - return - } - - for _, event := range logs { - *eventCounter++ - if o.OCRVersion == "1" { - answerUpdated, err := o.ocrV1Instances[0].ParseEventAnswerUpdated(event) - if err != nil { - o.log.Warn(). - Err(err). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Msg("Error parsing event as AnswerUpdated") - continue - } - if *eventCounter <= expectedEvents { - o.log.Info(). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Uint64("Round ID", answerUpdated.RoundId.Uint64()). - Int64("Answer", answerUpdated.Current.Int64()). - Msg("Answer Updated Event") - } else { - o.log.Error(). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Uint64("Round ID", answerUpdated.RoundId.Uint64()). - Int64("Answer", answerUpdated.Current.Int64()). - Msg("Excess event detected, beyond expected count") - } - } else if o.OCRVersion == "2" { - answerUpdated, err := o.ocrV2Instances[0].ParseEventAnswerUpdated(event) - if err != nil { - o.log.Warn(). - Err(err). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Msg("Error parsing event as AnswerUpdated") - continue - } - if *eventCounter <= expectedEvents { - o.log.Info(). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Uint64("Round ID", answerUpdated.RoundId.Uint64()). - Int64("Answer", answerUpdated.Current.Int64()). - Msg("Answer Updated Event") - } else { - o.log.Error(). - Str("Address", event.Address.Hex()). - Uint64("Block Number", event.BlockNumber). - Uint64("Round ID", answerUpdated.RoundId.Uint64()). - Int64("Answer", answerUpdated.Current.Int64()). - Msg("Excess event detected, beyond expected count") - } - } - } - *processedBlockNum = latestBlock -} - -// triggers a new OCR round by setting a new mock adapter value -func (o *OCRSoakTest) triggerNewRound(newValue int) error { - if len(o.ocrRoundStates) > 0 { - o.ocrRoundStates[len(o.ocrRoundStates)-1].EndTime = time.Now() - } - - var err error - switch o.OCRVersion { - case "1": - err = actions.SetAllAdapterResponsesToTheSameValue(newValue, o.ocrV1Instances, o.workerNodes, o.mockServer) - case "2": - err = actions.SetOCR2AllAdapterResponsesToTheSameValue(newValue, o.ocrV2Instances, o.workerNodes, o.mockServer) - } - if err != nil { - return err - } - - expectedState := &testreporters.OCRRoundState{ - StartTime: time.Now(), - Answer: int64(newValue), - FoundEvents: make(map[string][]*testreporters.FoundEvent), - } - switch o.OCRVersion { - case "1": - for _, ocrInstance := range o.ocrV1Instances { - expectedState.FoundEvents[ocrInstance.Address()] = make([]*testreporters.FoundEvent, 0) - } - case "2": - for _, ocrInstance := range o.ocrV2Instances { - expectedState.FoundEvents[ocrInstance.Address()] = make([]*testreporters.FoundEvent, 0) - } - } - - o.ocrRoundStates = append(o.ocrRoundStates, expectedState) - o.log.Info(). - Int("Value", newValue). - Msg("Starting a New OCR Round") - return nil -} - -func (o *OCRSoakTest) collectEvents() error { - start := time.Now() - if len(o.ocrRoundStates) == 0 { - return errors.New("error collecting on-chain events, no rounds have been started") - } - o.ocrRoundStates[len(o.ocrRoundStates)-1].EndTime = start // Set end time for last expected event - o.log.Info().Msg("Collecting on-chain events") - - // Set from block to be starting block before filtering - o.filterQuery.FromBlock = big.NewInt(0).SetUint64(o.startingBlockNum) - - // We must retrieve the events, use exponential backoff for timeout to retry - timeout := time.Second * 15 - o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") - - ctx, cancel := context.WithTimeout(testcontext.Get(o.t), timeout) - contractEvents, err := o.sethClient.Client.FilterLogs(ctx, o.filterQuery) - cancel() - for err != nil { - o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") - ctx, cancel := context.WithTimeout(testcontext.Get(o.t), timeout) - contractEvents, err = o.sethClient.Client.FilterLogs(ctx, o.filterQuery) - cancel() - if err != nil { - o.log.Warn().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Error collecting on-chain events, trying again") - timeout *= 2 - } - } - - sortedFoundEvents := make([]*testreporters.FoundEvent, 0) - for _, event := range contractEvents { - switch o.OCRVersion { - case "1": - answerUpdated, err := o.ocrV1Instances[0].ParseEventAnswerUpdated(event) - if err != nil { - return fmt.Errorf("error parsing EventAnswerUpdated for event: %v, %w", event, err) - } - sortedFoundEvents = append(sortedFoundEvents, &testreporters.FoundEvent{ - StartTime: time.Unix(answerUpdated.UpdatedAt.Int64(), 0), - Address: event.Address.Hex(), - Answer: answerUpdated.Current.Int64(), - RoundID: answerUpdated.RoundId.Uint64(), - BlockNumber: event.BlockNumber, - }) - case "2": - answerUpdated, err := o.ocrV2Instances[0].ParseEventAnswerUpdated(event) - if err != nil { - return fmt.Errorf("error parsing EventAnswerUpdated for event: %v, %w", event, err) - } - sortedFoundEvents = append(sortedFoundEvents, &testreporters.FoundEvent{ - StartTime: time.Unix(answerUpdated.UpdatedAt.Int64(), 0), - Address: event.Address.Hex(), - Answer: answerUpdated.Current.Int64(), - RoundID: answerUpdated.RoundId.Uint64(), - BlockNumber: event.BlockNumber, - }) - } - } - - // Sort our events by time to make sure they are in order (don't trust RPCs) - sort.Slice(sortedFoundEvents, func(i, j int) bool { - return sortedFoundEvents[i].StartTime.Before(sortedFoundEvents[j].StartTime) - }) - - // Now match each found event with the expected event time frame - expectedIndex := 0 - for _, event := range sortedFoundEvents { - if !event.StartTime.Before(o.ocrRoundStates[expectedIndex].EndTime) { - expectedIndex++ - if expectedIndex >= len(o.ocrRoundStates) { - o.log.Warn(). - Str("Event Time", event.StartTime.String()). - Str("Expected End Time", o.ocrRoundStates[expectedIndex].EndTime.String()). - Msg("Found events after last expected end time, adding event to that final report, things might be weird") - } - } - o.ocrRoundStates[expectedIndex].FoundEvents[event.Address] = append(o.ocrRoundStates[expectedIndex].FoundEvents[event.Address], event) - o.ocrRoundStates[expectedIndex].TimeLineEvents = append(o.ocrRoundStates[expectedIndex].TimeLineEvents, event) - } - - o.log.Info(). - Str("Time", time.Since(start).String()). - Int("Events collected", len(contractEvents)). - Msg("Collected on-chain events") - - if len(contractEvents) == 0 { - return errors.New("no events were collected") - } - - return nil -} - -// ensureValues ensures that all values needed to run the test are present -func (o *OCRSoakTest) ensureInputValues() error { - ocrConfig := o.Config.GetActiveOCRConfig() - if o.OCRVersion != "1" && o.OCRVersion != "2" { - return fmt.Errorf("OCR version must be 1 or 2, found %s", o.OCRVersion) - } - if ocrConfig.Common.NumberOfContracts != nil && *ocrConfig.Common.NumberOfContracts <= 0 { - return fmt.Errorf("number of OCR contracts must be set and greater than 0, found %d", ocrConfig.Common.NumberOfContracts) - } - if o.Config.Common.ChainlinkNodeFunding != nil && *o.Config.Common.ChainlinkNodeFunding <= 0 { - return fmt.Errorf("chainlink node funding must be greater than 0, found %f", *o.Config.Common.ChainlinkNodeFunding) - } - if o.Config.GetActiveOCRConfig().Common.TestDuration != nil && o.Config.GetActiveOCRConfig().Common.TestDuration.Duration <= time.Minute { - return fmt.Errorf("test duration must be greater than 1 minute, found %s", o.Config.GetActiveOCRConfig().Common.TestDuration) - } - soakConfig := ocrConfig.Soak - if soakConfig.TimeBetweenRounds != nil && soakConfig.TimeBetweenRounds.Duration >= time.Hour { - return fmt.Errorf("time between rounds must be less than 1 hour, found %s", soakConfig.TimeBetweenRounds) - } - if soakConfig.TimeBetweenRounds != nil && soakConfig.TimeBetweenRounds.Duration < time.Second*30 { - return fmt.Errorf("time between rounds must be greater or equal to 30 seconds, found %s", soakConfig.TimeBetweenRounds) - } - - return nil -} - -// getContractAddressesString returns the addresses of all OCR contracts deployed as a string slice -func (o *OCRSoakTest) getContractAddressesString() []string { - contractAddresses := []string{} - if len(o.ocrV1Instances) != 0 { - for _, ocrInstance := range o.ocrV1Instances { - contractAddresses = append(contractAddresses, ocrInstance.Address()) - } - } else if len(o.ocrV2Instances) != 0 { - if len(o.ocrV2Instances) != 0 { - for _, ocrInstance := range o.ocrV2Instances { - contractAddresses = append(contractAddresses, ocrInstance.Address()) - } - } - } - - return contractAddresses -} - -// getContractAddresses returns the addresses of all OCR contracts deployed -func (o *OCRSoakTest) getContractAddresses() []common.Address { - var contractAddresses []common.Address - if len(o.ocrV1Instances) != 0 { - for _, ocrInstance := range o.ocrV1Instances { - contractAddresses = append(contractAddresses, common.HexToAddress(ocrInstance.Address())) - } - } else if len(o.ocrV2Instances) != 0 { - if len(o.ocrV2Instances) != 0 { - for _, ocrInstance := range o.ocrV2Instances { - contractAddresses = append(contractAddresses, common.HexToAddress(ocrInstance.Address())) - } - } - } - - return contractAddresses -} - -func (o *OCRSoakTest) postGrafanaAnnotation(text string, tags []string) { - var grafanaClient *grafana.Client - var dashboardUID *string - if o.Config.Logging.Grafana != nil { - baseURL := o.Config.Logging.Grafana.BaseUrl - dashboardUID = o.Config.Logging.Grafana.DashboardUID - token := o.Config.Logging.Grafana.BearerToken - if token == nil || baseURL == nil || dashboardUID == nil { - o.log.Warn().Msg("Skipping Grafana annotation. Grafana config is missing either BearerToken, BaseUrl or DashboardUID") - return - } - grafanaClient = grafana.NewGrafanaClient(*baseURL, *token) - } - _, _, err := grafanaClient.PostAnnotation(grafana.PostAnnotation{ - DashboardUID: *dashboardUID, - Tags: tags, - Text: fmt.Sprintf("Test Namespace: %s
%s
", o.namespace, text), - }) - if err != nil { - o.log.Error().Err(err).Msg("Error posting annotation to Grafana") - } else { - o.log.Info().Msgf("Annotated Grafana dashboard with text: %s", text) - } -} - -type ocrTestChaosListener struct { - t *testing.T -} - -func (l ocrTestChaosListener) OnChaosCreated(_ havoc.Chaos) { -} - -func (l ocrTestChaosListener) OnChaosCreationFailed(chaos havoc.Chaos, reason error) { - // Fail the test if chaos creation fails during chaos simulation - require.FailNow(l.t, "Error creating chaos simulation", reason.Error(), chaos) -} - -func (l ocrTestChaosListener) OnChaosStarted(_ havoc.Chaos) { -} - -func (l ocrTestChaosListener) OnChaosPaused(_ havoc.Chaos) { -} - -func (l ocrTestChaosListener) OnChaosEnded(_ havoc.Chaos) { -} - -func (l ocrTestChaosListener) OnChaosStatusUnknown(_ havoc.Chaos) { -} diff --git a/integration-tests/types/testconfigs.go b/integration-tests/types/testconfigs.go deleted file mode 100644 index 16f7253a2e3..00000000000 --- a/integration-tests/types/testconfigs.go +++ /dev/null @@ -1,59 +0,0 @@ -package types - -import ( - ctf_config "github.com/smartcontractkit/chainlink-testing-framework/lib/config" - "github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" -) - -type VRFv2TestConfig interface { - tc.CommonTestConfig - ctf_config.GlobalTestConfig - tc.VRFv2TestConfig -} - -type VRFv2PlusTestConfig interface { - tc.CommonTestConfig - ctf_config.GlobalTestConfig - tc.VRFv2PlusTestConfig -} - -type FunctionsTestConfig interface { - tc.CommonTestConfig - ctf_config.GlobalTestConfig - tc.FunctionsTestConfig -} - -type AutomationTestConfig interface { - ctf_config.GlobalTestConfig - tc.CommonTestConfig - tc.UpgradeableChainlinkTestConfig - tc.AutomationTestConfig -} - -type AutomationBenchmarkTestConfig interface { - ctf_config.GlobalTestConfig - tc.CommonTestConfig - tc.AutomationTestConfig - ctf_config.NamedConfigurations - testreporters.GrafanaURLProvider -} - -type OcrTestConfig interface { - ctf_config.GlobalTestConfig - tc.CommonTestConfig - tc.OcrTestConfig - ctf_config.SethConfig -} - -type Ocr2TestConfig interface { - ctf_config.GlobalTestConfig - tc.CommonTestConfig - tc.Ocr2TestConfig -} - -type CCIPTestConfig interface { - ctf_config.GlobalTestConfig - tc.CommonTestConfig - tc.CCIPTestConfig -} diff --git a/integration-tests/universal/log_poller/gun.go b/integration-tests/universal/log_poller/gun.go deleted file mode 100644 index 287041ce411..00000000000 --- a/integration-tests/universal/log_poller/gun.go +++ /dev/null @@ -1,79 +0,0 @@ -package logpoller - -import ( - "fmt" - "sync" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/rs/zerolog" - - "github.com/smartcontractkit/chainlink-testing-framework/wasp" - - "github.com/smartcontractkit/chainlink/integration-tests/contracts" -) - -/* LogEmitterGun is a gun that constantly emits logs from a contract */ -type LogEmitterGun struct { - contract *contracts.LogEmitter - eventsToEmit []abi.Event - logger zerolog.Logger - eventsPerTx int -} - -type Counter struct { - mu *sync.Mutex - value int -} - -func NewLogEmitterGun( - contract *contracts.LogEmitter, - eventsToEmit []abi.Event, - eventsPerTx int, - logger zerolog.Logger, -) *LogEmitterGun { - return &LogEmitterGun{ - contract: contract, - eventsToEmit: eventsToEmit, - eventsPerTx: eventsPerTx, - logger: logger, - } -} - -func (m *LogEmitterGun) Call(l *wasp.Generator) *wasp.Response { - localCounter := 0 - logEmitter := (*m.contract) - address := logEmitter.Address() - for _, event := range m.eventsToEmit { - m.logger.Debug().Str("Emitter address", address.String()).Str("Event type", event.Name).Msg("Emitting log from emitter") - var err error - switch event.Name { - case "Log1": - _, err = logEmitter.EmitLogInts(getIntSlice(m.eventsPerTx)) - case "Log2": - _, err = logEmitter.EmitLogIntsIndexed(getIntSlice(m.eventsPerTx)) - case "Log3": - _, err = logEmitter.EmitLogStrings(getStringSlice(m.eventsPerTx)) - default: - err = fmt.Errorf("unknown event name: %s", event.Name) - } - - if err != nil { - return &wasp.Response{Error: err.Error(), Failed: true} - } - localCounter++ - } - - // I don't think that will work as expected, I should atomically read the value and save it, so maybe just a mutex? - if counter, ok := l.InputSharedData().(*Counter); ok { - counter.mu.Lock() - defer counter.mu.Unlock() - counter.value += localCounter - } else { - return &wasp.Response{ - Error: "SharedData did not contain a Counter", - Failed: true, - } - } - - return &wasp.Response{} -} diff --git a/integration-tests/universal/log_poller/helpers.go b/integration-tests/universal/log_poller/helpers.go deleted file mode 100644 index 7221ef14f2a..00000000000 --- a/integration-tests/universal/log_poller/helpers.go +++ /dev/null @@ -1,1241 +0,0 @@ -package logpoller - -import ( - "bytes" - "context" - "errors" - "fmt" - "math" - "math/big" - "math/rand" - "sort" - "strings" - "sync" - "sync/atomic" - "testing" - "time" - - geth "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/common" - geth_types "github.com/ethereum/go-ethereum/core/types" - "github.com/jmoiron/sqlx" - "github.com/rs/zerolog" - "github.com/scylladb/go-reflectx" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-evm/pkg/logpoller" - "github.com/smartcontractkit/chainlink-testing-framework/seth" - "github.com/smartcontractkit/chainlink-testing-framework/wasp" - "github.com/smartcontractkit/chainlink/integration-tests/utils" - - ac "github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/automation_compatible_utils" - le "github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/log_emitter" - cltypes "github.com/smartcontractkit/chainlink-evm/pkg/types" - "github.com/smartcontractkit/chainlink-testing-framework/lib/blockchain" - ctf_concurrency "github.com/smartcontractkit/chainlink-testing-framework/lib/concurrency" - ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env" - "github.com/smartcontractkit/chainlink-testing-framework/lib/logging" - "github.com/smartcontractkit/chainlink-testing-framework/lib/networks" - "github.com/smartcontractkit/chainlink/deployment/environment/nodeclient" - "github.com/smartcontractkit/chainlink/integration-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" - tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - lp_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/log_poller" - core_logger "github.com/smartcontractkit/chainlink/v2/core/logger" -) - -var ( - EmitterABI, _ = abi.JSON(strings.NewReader(le.LogEmitterABI)) - automatoinConvABI = cltypes.MustGetABI(ac.AutomationCompatibleUtilsABI) - bytes0 = [32]byte{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - } // bytes representation of 0x0000000000000000000000000000000000000000000000000000000000000000 - -) - -var registerSingleTopicFilter = func(registry contracts.KeeperRegistry, upkeepID *big.Int, emitterAddress common.Address, topic common.Hash) error { - logTriggerConfigStruct := ac.IAutomationV21PlusCommonLogTriggerConfig{ - ContractAddress: emitterAddress, - FilterSelector: 0, - Topic0: topic, - Topic1: bytes0, - Topic2: bytes0, - Topic3: bytes0, - } - encodedLogTriggerConfig, err := automatoinConvABI.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) - if err != nil { - return err - } - - err = registry.SetUpkeepTriggerConfig(upkeepID, encodedLogTriggerConfig) - if err != nil { - return err - } - - return nil -} - -// Currently Unused November 8, 2023, Might be useful in the near future so keeping it here for now -// this is not really possible, log trigger doesn't support multiple topics, even if log poller does -// var registerMultipleTopicsFilter = func(registry contracts.KeeperRegistry, upkeepID *big.Int, emitterAddress common.Address, topics []abi.Event) error { -// if len(topics) > 4 { -// return errors.New("Cannot register more than 4 topics") -// } - -// var getTopic = func(topics []abi.Event, i int) common.Hash { -// if i > len(topics)-1 { -// return bytes0 -// } - -// return topics[i].ID -// } - -// var getFilterSelector = func(topics []abi.Event) (uint8, error) { -// switch len(topics) { -// case 0: -// return 0, errors.New("Cannot register filter with 0 topics") -// case 1: -// return 0, nil -// case 2: -// return 1, nil -// case 3: -// return 3, nil -// case 4: -// return 7, nil -// default: -// return 0, errors.New("Cannot register filter with more than 4 topics") -// } -// } - -// filterSelector, err := getFilterSelector(topics) -// if err != nil { -// return err -// } - -// logTriggerConfigStruct := automation_convenience.LogTriggerConfig{ -// ContractAddress: emitterAddress, -// FilterSelector: filterSelector, -// Topic0: getTopic(topics, 0), -// Topic1: getTopic(topics, 1), -// Topic2: getTopic(topics, 2), -// Topic3: getTopic(topics, 3), -// } -// encodedLogTriggerConfig, err := automatoinConvABI.Methods["_logTriggerConfig"].Inputs.Pack(&logTriggerConfigStruct) -// if err != nil { -// return err -// } - -// err = registry.SetUpkeepTriggerConfig(upkeepID, encodedLogTriggerConfig) -// if err != nil { -// return err -// } - -// return nil -// } - -// NewORM returns a new logpoller.orm instance -func NewORM(logger core_logger.SugaredLogger, chainID *big.Int, postgresDb *ctf_test_env.PostgresDb) (logpoller.ORM, *sqlx.DB, error) { - dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable", "127.0.0.1", postgresDb.ExternalPort, postgresDb.User, postgresDb.Password, postgresDb.DbName) - db, err := sqlx.Open("postgres", dsn) - if err != nil { - return nil, db, err - } - - db.MapperFunc(reflectx.CamelToSnakeASCII) - return logpoller.NewORM(chainID, db, logger), db, nil -} - -type ExpectedFilter struct { - emitterAddress common.Address - topic common.Hash -} - -// GetExpectedFilters returns a slice of ExpectedFilter structs based on the provided log emitters and config -func GetExpectedFilters(logEmitters []*contracts.LogEmitter, cfg *lp_config.Config) []ExpectedFilter { - expectedFilters := make([]ExpectedFilter, 0) - for _, emitter := range logEmitters { - for _, event := range cfg.General.EventsToEmit { - expectedFilters = append(expectedFilters, ExpectedFilter{ - emitterAddress: (*emitter).Address(), - topic: event.ID, - }) - } - } - - return expectedFilters -} - -// NodeHasExpectedFilters returns true if the provided node has all the expected filters registered -func NodeHasExpectedFilters(ctx context.Context, expectedFilters []ExpectedFilter, logger core_logger.SugaredLogger, chainID *big.Int, postgresDb *ctf_test_env.PostgresDb) (bool, string, error) { - orm, db, err := NewORM(logger, chainID, postgresDb) - if err != nil { - return false, "", err - } - - defer db.Close() - knownFilters, err := orm.LoadFilters(ctx) - if err != nil { - return false, "", err - } - - for _, expectedFilter := range expectedFilters { - filterFound := false - for _, knownFilter := range knownFilters { - if bytes.Equal(expectedFilter.emitterAddress.Bytes(), knownFilter.Addresses[0].Bytes()) && bytes.Equal(expectedFilter.topic.Bytes(), knownFilter.EventSigs[0].Bytes()) { - filterFound = true - break - } - } - - if !filterFound { - return false, fmt.Sprintf("no filter found for emitter %s and topic %s", expectedFilter.emitterAddress.String(), expectedFilter.topic.Hex()), nil - } - } - - return true, "", nil -} - -// randomWait waits for a random amount of time between minMilliseconds and maxMilliseconds -func randomWait(minMilliseconds, maxMilliseconds int) { - rand.New(rand.NewSource(time.Now().UnixNano())) - randomMilliseconds := rand.Intn(maxMilliseconds-minMilliseconds+1) + minMilliseconds - time.Sleep(time.Duration(randomMilliseconds) * time.Millisecond) -} - -// getIntSlice returns a slice of ints of the provided length -func getIntSlice(length int) []int { - result := make([]int, length) - for i := range length { - result[i] = i - } - - return result -} - -// getStringSlice returns a slice of strings of the provided length -func getStringSlice(length int) []string { - result := make([]string, length) - for i := range length { - result[i] = "amazing event" - } - - return result -} - -// LogPollerHasFinalisedEndBlock returns true if all CL nodes have finalised processing the provided end block -func LogPollerHasFinalisedEndBlock(endBlock int64, chainID *big.Int, l zerolog.Logger, coreLogger core_logger.SugaredLogger, nodes *test_env.ClCluster) (bool, error) { - wg := &sync.WaitGroup{} - - type boolQueryResult struct { - nodeName string - hasFinalised bool - finalizedBlock int64 - err error - } - - endBlockCh := make(chan boolQueryResult, len(nodes.Nodes)-1) - ctx, cancelFn := context.WithCancel(context.Background()) - - for i := 1; i < len(nodes.Nodes); i++ { - wg.Add(1) - - go func(clNode *test_env.ClNode, r chan boolQueryResult) { - defer wg.Done() - select { - case <-ctx.Done(): - return - default: - orm, db, err := NewORM(coreLogger, chainID, clNode.PostgresDb) - if err != nil { - r <- boolQueryResult{ - nodeName: clNode.ContainerName, - hasFinalised: false, - err: err, - } - } - - defer db.Close() - - latestBlock, err := orm.SelectLatestBlock(ctx) - if err != nil { - r <- boolQueryResult{ - nodeName: clNode.ContainerName, - hasFinalised: false, - err: err, - } - } - - r <- boolQueryResult{ - nodeName: clNode.ContainerName, - finalizedBlock: latestBlock.FinalizedBlockNumber, - hasFinalised: latestBlock.FinalizedBlockNumber > endBlock, - err: nil, - } - } - }(nodes.Nodes[i], endBlockCh) - } - - var err error - allFinalisedCh := make(chan bool, 1) - - go func() { - foundMap := make(map[string]bool, 0) - for r := range endBlockCh { - if r.err != nil { - err = r.err - cancelFn() - return - } - - foundMap[r.nodeName] = r.hasFinalised - if r.hasFinalised { - l.Info().Str("Node name", r.nodeName).Msg("CL node has finalised end block") - } else { - l.Warn().Int64("Has", r.finalizedBlock).Int64("Want", endBlock).Str("Node name", r.nodeName).Msg("CL node has not finalised end block yet") - } - - if len(foundMap) == len(nodes.Nodes)-1 { - allFinalised := true - for _, v := range foundMap { - if !v { - allFinalised = false - break - } - } - - allFinalisedCh <- allFinalised - return - } - } - }() - - wg.Wait() - close(endBlockCh) - - return <-allFinalisedCh, err -} - -// ClNodesHaveExpectedLogCount returns true if all CL nodes have the expected log count in the provided block range and matching the provided filters -func ClNodesHaveExpectedLogCount(startBlock, endBlock int64, chainID *big.Int, expectedLogCount int, expectedFilters []ExpectedFilter, l zerolog.Logger, coreLogger core_logger.SugaredLogger, nodes *test_env.ClCluster) (bool, error) { - wg := &sync.WaitGroup{} - - type logQueryResult struct { - nodeName string - logCount int - hasExpectedCount bool - err error - } - - resultChan := make(chan logQueryResult, len(nodes.Nodes)-1) - ctx, cancelFn := context.WithCancel(context.Background()) - - for i := 1; i < len(nodes.Nodes); i++ { - wg.Add(1) - - go func(clNode *test_env.ClNode, resultChan chan logQueryResult) { - defer wg.Done() - select { - case <-ctx.Done(): - return - default: - orm, db, err := NewORM(coreLogger, chainID, clNode.PostgresDb) - if err != nil { - resultChan <- logQueryResult{ - nodeName: clNode.ContainerName, - logCount: 0, - hasExpectedCount: false, - err: err, - } - } - - defer db.Close() - foundLogsCount := 0 - - for _, filter := range expectedFilters { - logs, err := orm.SelectLogs(ctx, startBlock, endBlock, filter.emitterAddress, filter.topic) - if err != nil { - resultChan <- logQueryResult{ - nodeName: clNode.ContainerName, - logCount: 0, - hasExpectedCount: false, - err: err, - } - } - - foundLogsCount += len(logs) - } - - resultChan <- logQueryResult{ - nodeName: clNode.ContainerName, - logCount: foundLogsCount, - hasExpectedCount: foundLogsCount >= expectedLogCount, - err: nil, - } - } - }(nodes.Nodes[i], resultChan) - } - - var err error - allFoundCh := make(chan bool, 1) - - go func() { - foundMap := make(map[string]bool, 0) - for r := range resultChan { - if r.err != nil { - err = r.err - cancelFn() - return - } - - foundMap[r.nodeName] = r.hasExpectedCount - if r.hasExpectedCount { - l.Debug(). - Str("Node name", r.nodeName). - Int("Logs count", r.logCount). - Msg("Expected log count found in CL node") - } else { - l.Debug(). - Str("Node name", r.nodeName). - Str("Found/Expected logs", fmt.Sprintf("%d/%d", r.logCount, expectedLogCount)). - Int("Missing logs", expectedLogCount-r.logCount). - Msg("Too low log count found in CL node") - } - - if len(foundMap) == len(nodes.Nodes)-1 { - allFound := true - for _, hadAllLogs := range foundMap { - if !hadAllLogs { - allFound = false - break - } - } - - allFoundCh <- allFound - return - } - } - }() - - wg.Wait() - close(resultChan) - - return <-allFoundCh, err -} - -type MissingLogs map[string][]geth_types.Log - -// IsEmpty returns true if there are no missing logs -func (m *MissingLogs) IsEmpty() bool { - for _, v := range *m { - if len(v) > 0 { - return false - } - } - - return true -} - -// GetMissingLogs returns a map of CL node name to missing logs in that node compared to EVM node to which the provided evm client is connected -func GetMissingLogs( - startBlock, endBlock int64, - logEmitters []*contracts.LogEmitter, - client *seth.Client, - clnodeCluster *test_env.ClCluster, - l zerolog.Logger, - coreLogger core_logger.SugaredLogger, - cfg *lp_config.Config, -) (MissingLogs, error) { - wg := &sync.WaitGroup{} - - type dbQueryResult struct { - err error - nodeName string - logs []logpoller.Log - } - - ctx, cancelFn := context.WithCancel(context.Background()) - resultCh := make(chan dbQueryResult, len(clnodeCluster.Nodes)-1) - - for i := 1; i < len(clnodeCluster.Nodes); i++ { - wg.Add(1) - - go func(ctx context.Context, i int, r chan dbQueryResult) { - defer wg.Done() - select { - case <-ctx.Done(): - l.Warn().Msg("Context cancelled. Terminating fetching logs from log poller's DB") - return - default: - nodeName := clnodeCluster.Nodes[i].ContainerName - - l.Debug().Str("Node name", nodeName).Msg("Fetching log poller logs") - orm, db, err := NewORM(coreLogger, big.NewInt(client.ChainID), clnodeCluster.Nodes[i].PostgresDb) - if err != nil { - r <- dbQueryResult{ - err: err, - nodeName: nodeName, - logs: []logpoller.Log{}, - } - } - - defer db.Close() - logs := make([]logpoller.Log, 0) - - for j := range logEmitters { - address := (*logEmitters[j]).Address() - - for _, event := range cfg.General.EventsToEmit { - l.Trace().Str("Event name", event.Name).Str("Emitter address", address.String()).Msg("Fetching single emitter's logs") - result, err := orm.SelectLogs(ctx, startBlock, endBlock, address, event.ID) - if err != nil { - r <- dbQueryResult{ - err: err, - nodeName: nodeName, - logs: []logpoller.Log{}, - } - } - - sort.Slice(result, func(i, j int) bool { - return result[i].BlockNumber < result[j].BlockNumber - }) - - logs = append(logs, result...) - - l.Trace().Str("Event name", event.Name).Str("Emitter address", address.String()).Int("Log count", len(result)).Msg("Logs found per node") - } - } - - l.Info().Int("Count", len(logs)).Str("Node name", nodeName).Msg("Fetched log poller logs") - - r <- dbQueryResult{ - err: nil, - nodeName: nodeName, - logs: logs, - } - } - }(ctx, i, resultCh) - } - - allLogPollerLogs := make(map[string][]logpoller.Log, 0) - missingLogs := map[string][]geth_types.Log{} - var dbError error - - go func() { - for r := range resultCh { - if r.err != nil { - l.Err(r.err).Str("Node name", r.nodeName).Msg("Error fetching logs from log poller's DB") - dbError = r.err - cancelFn() - return - } - // use channel for aggregation and then for := range over it after closing resultCh? - allLogPollerLogs[r.nodeName] = r.logs - } - }() - - wg.Wait() - close(resultCh) - - if dbError != nil { - return nil, dbError - } - - allLogsInEVMNode, err := getEVMLogs(ctx, startBlock, endBlock, logEmitters, client, l, cfg) - if err != nil { - return nil, err - } - - wg = &sync.WaitGroup{} - - type missingLogResult struct { - nodeName string - logs []geth_types.Log - } - - evmLogCount := len(allLogsInEVMNode) - l.Info().Int("Log count", evmLogCount).Msg("Started comparison of logs from EVM node and CL nodes. This may take a while if there's a lot of logs") - - missingCh := make(chan missingLogResult, len(clnodeCluster.Nodes)-1) - for i := 1; i < len(clnodeCluster.Nodes); i++ { - wg.Add(1) - - go func(i int, result chan missingLogResult) { - defer wg.Done() - nodeName := clnodeCluster.Nodes[i].ContainerName - l.Debug().Str("Node name", nodeName).Str("Progress", fmt.Sprintf("0/%d", evmLogCount)).Msg("Comparing single CL node's logs with EVM logs") - - missingLogs := make([]geth_types.Log, 0) - for i, evmLog := range allLogsInEVMNode { - logFound := false - if evmLog.BlockNumber > math.MaxInt64 { - panic(fmt.Errorf("block number overflows int64: %d", evmLog.BlockNumber)) - } - if evmLog.Index > math.MaxInt64 { - panic(fmt.Errorf("index overflows int64: %d", evmLog.Index)) - } - for _, logPollerLog := range allLogPollerLogs[nodeName] { - if logPollerLog.BlockNumber == int64(evmLog.BlockNumber) && logPollerLog.TxHash == evmLog.TxHash && bytes.Equal(logPollerLog.Data, evmLog.Data) && logPollerLog.LogIndex == int64(evmLog.Index) && - logPollerLog.Address == evmLog.Address && logPollerLog.BlockHash == evmLog.BlockHash && bytes.Equal(logPollerLog.Topics[0], evmLog.Topics[0].Bytes()) { - logFound = true - continue - } - } - - if i%10000 == 0 && i != 0 { - l.Debug().Str("Node name", nodeName).Str("Progress", fmt.Sprintf("%d/%d", i, evmLogCount)).Msg("Comparing single CL node's logs with EVM logs") - } - - if !logFound { - missingLogs = append(missingLogs, evmLog) - } - } - - if len(missingLogs) > 0 { - l.Warn().Int("Count", len(missingLogs)).Str("Node name", nodeName).Msg("Some EMV logs were missing from CL node") - } else { - l.Info().Str("Node name", nodeName).Str("Missing/Total logs", fmt.Sprintf("%d/%d", len(missingLogs), evmLogCount)).Msg("All EVM logs were found in CL node") - } - - result <- missingLogResult{ - nodeName: nodeName, - logs: missingLogs, - } - }(i, missingCh) - } - - wg.Wait() - close(missingCh) - - for v := range missingCh { - if len(v.logs) > 0 { - missingLogs[v.nodeName] = v.logs - } - } - - expectedTotalLogsEmitted := GetExpectedLogCount(cfg) - if int64(len(allLogsInEVMNode)) != expectedTotalLogsEmitted { - l.Warn(). - Str("Actual/Expected", fmt.Sprintf("%d/%d", expectedTotalLogsEmitted, len(allLogsInEVMNode))). - Msg("Actual number of logs found on EVM nodes differs from expected ones. Most probably this is a bug in the test") - } - - return missingLogs, nil -} - -// PrintMissingLogsInfo prints various useful information about the missing logs -func PrintMissingLogsInfo(missingLogs map[string][]geth_types.Log, l zerolog.Logger, cfg *lp_config.Config) { - var findHumanName = func(topic common.Hash) string { - for _, event := range cfg.General.EventsToEmit { - if event.ID == topic { - return event.Name - } - } - - return "Unknown event" - } - - missingByType := make(map[string]int) - for _, logs := range missingLogs { - for _, v := range logs { - humanName := findHumanName(v.Topics[0]) - missingByType[humanName]++ - } - } - - l.Debug().Msg("Missing log by event name") - for k, v := range missingByType { - l.Debug().Str("Event name", k).Int("Missing count", v).Msg("Missing logs by type") - } - - missingByBlock := make(map[uint64]int) - for _, logs := range missingLogs { - for _, l := range logs { - missingByBlock[l.BlockNumber]++ - } - } - - l.Debug().Msg("Missing logs by block") - for k, v := range missingByBlock { - l.Debug().Uint64("Block number", k).Int("Missing count", v).Msg("Missing logs by block") - } - - missingByEmitter := make(map[string]int) - for _, logs := range missingLogs { - for _, l := range logs { - missingByEmitter[l.Address.String()]++ - } - } - - l.Debug().Msg("Missing logs by emitter") - for k, v := range missingByEmitter { - l.Debug().Str("Emitter address", k).Int("Missing count", v).Msg("Missing logs by emitter") - } -} - -// getEVMLogs returns a slice of all logs emitted by the provided log emitters in the provided block range, -// which are present in the EVM node to which the provided evm client is connected -func getEVMLogs(ctx context.Context, startBlock, endBlock int64, logEmitters []*contracts.LogEmitter, client *seth.Client, l zerolog.Logger, cfg *lp_config.Config) ([]geth_types.Log, error) { - allLogsInEVMNode := make([]geth_types.Log, 0) - for j := range logEmitters { - address := (*logEmitters[j]).Address() - for _, event := range cfg.General.EventsToEmit { - l.Debug().Str("Event name", event.Name).Str("Emitter address", address.String()).Msg("Fetching logs from EVM node") - logsInEVMNode, err := client.Client.FilterLogs(ctx, geth.FilterQuery{ - Addresses: []common.Address{(address)}, - Topics: [][]common.Hash{{event.ID}}, - FromBlock: big.NewInt(startBlock), - ToBlock: big.NewInt(endBlock), - }) - if err != nil { - return nil, err - } - - sort.Slice(logsInEVMNode, func(i, j int) bool { - return logsInEVMNode[i].BlockNumber < logsInEVMNode[j].BlockNumber - }) - - allLogsInEVMNode = append(allLogsInEVMNode, logsInEVMNode...) - l.Debug().Str("Event name", event.Name).Str("Emitter address", address.String()).Int("Log count", len(logsInEVMNode)).Msg("Logs found in EVM node") - } - } - - l.Info().Int("Count", len(allLogsInEVMNode)).Msg("Logs in EVM node") - - return allLogsInEVMNode, nil -} - -// ExecuteGenerator executes the configured generator and returns the total number of logs emitted -func ExecuteGenerator(t *testing.T, cfg *lp_config.Config, client *seth.Client, logEmitters []*contracts.LogEmitter) (int, error) { - if *cfg.General.Generator == lp_config.GeneratorType_WASP { - return runWaspGenerator(t, cfg, logEmitters) - } - - return runLoopedGenerator(t, cfg, client, logEmitters) -} - -// runWaspGenerator runs the wasp generator and returns the total number of logs emitted -func runWaspGenerator(t *testing.T, cfg *lp_config.Config, logEmitters []*contracts.LogEmitter) (int, error) { - l := logging.GetTestLogger(t) - - var RPSprime int64 - - // if LPS is set, we need to calculate based on countract count and events per transaction - if *cfg.Wasp.LPS > 0 { - RPSprime = *cfg.Wasp.LPS / int64(*cfg.General.Contracts) / int64(*cfg.General.EventsPerTx) / int64(len(cfg.General.EventsToEmit)) - - if RPSprime < 1 { - return 0, errors.New("invalid load configuration, effective RPS would have been zero. Adjust LPS, contracts count, events per tx or events to emit") - } - } - - // if RPS is set simply split it between contracts - if *cfg.Wasp.RPS > 0 { - RPSprime = *cfg.Wasp.RPS / int64(*cfg.General.Contracts) - } - - counter := &Counter{ - mu: &sync.Mutex{}, - value: 0, - } - - p := wasp.NewProfile() - - for _, logEmitter := range logEmitters { - g, err := wasp.NewGenerator(&wasp.Config{ - T: t, - LoadType: wasp.RPS, - GenName: "log_poller_gen_" + (*logEmitter).Address().String(), - RateLimitUnitDuration: cfg.Wasp.RateLimitUnitDuration.Duration, - CallTimeout: cfg.Wasp.CallTimeout.Duration, - Schedule: wasp.Plain( - RPSprime, - cfg.Wasp.Duration.Duration, - ), - Gun: NewLogEmitterGun( - logEmitter, - cfg.General.EventsToEmit, - *cfg.General.EventsPerTx, - l, - ), - SharedData: counter, - }) - p.Add(g, err) - } - - _, err := p.Run(true) - - if err != nil { - return 0, err - } - - return counter.value, nil -} - -type logEmissionTask struct { - emitter *contracts.LogEmitter - eventsToEmit []abi.Event - eventsPerTx int -} - -type emittedLogsData struct { - count int -} - -func (d emittedLogsData) GetResult() emittedLogsData { - return d -} - -// runLoopedGenerator runs the looped generator and returns the total number of logs emitted -func runLoopedGenerator(t *testing.T, cfg *lp_config.Config, client *seth.Client, logEmitters []*contracts.LogEmitter) (int, error) { - l := logging.GetTestLogger(t) - - tasks := make([]logEmissionTask, 0) - for i := 0; i < *cfg.LoopedConfig.ExecutionCount; i++ { - for _, logEmitter := range logEmitters { - tasks = append(tasks, logEmissionTask{ - emitter: logEmitter, - eventsToEmit: cfg.General.EventsToEmit, - eventsPerTx: *cfg.General.EventsPerTx, - }) - } - } - - l.Info().Int("Total tasks", len(tasks)).Msg("Starting to emit events") - - var atomicCounter = atomic.Int32{} - - var emitAllEventsFn = func(resultCh chan emittedLogsData, errorCh chan error, _ int, task logEmissionTask) { - current := atomicCounter.Add(1) - - address := (*task.emitter).Address().String() - - for _, event := range cfg.General.EventsToEmit { - l.Debug().Str("Emitter address", address).Str("Event type", event.Name).Str("index", fmt.Sprintf("%d/%d", current, *cfg.LoopedConfig.ExecutionCount)).Msg("Emitting log from emitter") - var err error - switch event.Name { - case "Log1": - _, err = client.Decode((*task.emitter).EmitLogIntsFromKey(getIntSlice(*cfg.General.EventsPerTx), client.AnySyncedKey())) - case "Log2": - _, err = client.Decode((*task.emitter).EmitLogIntsIndexedFromKey(getIntSlice(*cfg.General.EventsPerTx), client.AnySyncedKey())) - case "Log3": - _, err = client.Decode((*task.emitter).EmitLogStringsFromKey(getStringSlice(*cfg.General.EventsPerTx), client.AnySyncedKey())) - case "Log4": - _, err = client.Decode((*task.emitter).EmitLogIntMultiIndexedFromKey(1, 1, *cfg.General.EventsPerTx, client.AnySyncedKey())) - default: - err = fmt.Errorf("unknown event name: %s", event.Name) - } - - if err != nil { - errorCh <- err - return - } - randomWait(*cfg.LoopedConfig.MinEmitWaitTimeMs, *cfg.LoopedConfig.MaxEmitWaitTimeMs) - - if (current)%10 == 0 { - l.Info().Str("Emitter address", address).Str("Index", fmt.Sprintf("%d/%d", current, *cfg.LoopedConfig.ExecutionCount)).Msgf("Emitted all %d events", len(cfg.General.EventsToEmit)) - } - } - - resultCh <- emittedLogsData{ - *cfg.General.EventsPerTx * len(cfg.General.EventsToEmit), - } - } - - executor := ctf_concurrency.NewConcurrentExecutor[emittedLogsData, emittedLogsData, logEmissionTask](l) - r, err := executor.Execute(int(*client.Cfg.EphemeralAddrs), tasks, emitAllEventsFn) - - if err != nil { - return 0, err - } - - var total int - for _, result := range r { - total += result.count - } - - return total, nil -} - -// GetExpectedLogCount returns the expected number of logs to be emitted based on the provided config -func GetExpectedLogCount(cfg *lp_config.Config) int64 { - if *cfg.General.Generator == lp_config.GeneratorType_WASP { - if *cfg.Wasp.RPS != 0 { - return *cfg.Wasp.RPS * int64(cfg.Wasp.Duration.Seconds()) * int64(*cfg.General.EventsPerTx) - } - return *cfg.Wasp.LPS * int64(cfg.Wasp.Duration.Seconds()) - } - - return int64(len(cfg.General.EventsToEmit) * *cfg.LoopedConfig.ExecutionCount * *cfg.General.Contracts * *cfg.General.EventsPerTx) -} - -type PauseData struct { - StartBlock uint64 - EndBlock uint64 - TargetComponent string - ContaineName string -} - -var ChaosPauses = []PauseData{} - -// chaosPauseSyncFn pauses ranom container of the provided type for a random amount of time between 5 and 20 seconds -func chaosPauseSyncFn(l zerolog.Logger, client *seth.Client, cluster *test_env.ClCluster, targetComponent string) ChaosPauseData { - rand.New(rand.NewSource(time.Now().UnixNano())) - - randomNode := cluster.Nodes[rand.Intn(len(cluster.Nodes)-1)+1] - var component ctf_test_env.EnvComponent - - switch strings.ToLower(targetComponent) { - case "chainlink": - component = randomNode.EnvComponent - case "postgres": - component = randomNode.PostgresDb.EnvComponent - default: - return ChaosPauseData{Err: fmt.Errorf("unknown component %s", targetComponent)} - } - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - pauseStartBlock, err := client.Client.BlockNumber(ctx) - if err != nil { - return ChaosPauseData{Err: err} - } - pauseTimeSec := rand.Intn(20-5) + 5 - l.Info().Str("Container", component.ContainerName).Int("Pause time", pauseTimeSec).Msg("Pausing component") - pauseTimeDur := time.Duration(pauseTimeSec) * time.Second - err = component.ChaosPause(l, pauseTimeDur) - if err != nil { - return ChaosPauseData{Err: err} - } - l.Info().Str("Container", component.ContainerName).Msg("Component unpaused") - - ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - pauseEndBlock, err := client.Client.BlockNumber(ctx) - if err != nil { - return ChaosPauseData{Err: err} - } - - return ChaosPauseData{PauseData: PauseData{ - StartBlock: pauseStartBlock, - EndBlock: pauseEndBlock, - TargetComponent: targetComponent, - ContaineName: component.ContainerName, - }} -} - -type ChaosPauseData struct { - Err error - PauseData PauseData -} - -// ExecuteChaosExperiment executes the configured chaos experiment, which consist of pausing CL node or Postgres containers -func ExecuteChaosExperiment(l zerolog.Logger, testEnv *test_env.CLClusterTestEnv, sethClient *seth.Client, testConfig *tc.TestConfig, errorCh chan error) { - if testConfig == nil || testConfig.LogPoller.ChaosConfig == nil || *testConfig.LogPoller.ChaosConfig.ExperimentCount == 0 { - errorCh <- nil - return - } - - chaosChan := make(chan ChaosPauseData, *testConfig.LogPoller.ChaosConfig.ExperimentCount) - wg := &sync.WaitGroup{} - - go func() { - // if we wanted to have more than 1 container paused, we'd need to make sure we aren't trying to pause an already paused one - guardChan := make(chan struct{}, 1) - - for i := 0; i < *testConfig.LogPoller.ChaosConfig.ExperimentCount; i++ { - i := i - wg.Add(1) - guardChan <- struct{}{} - go func() { - defer func() { - <-guardChan - wg.Done() - current := i + 1 - l.Info().Str("Current/Total", fmt.Sprintf("%d/%d", current, *testConfig.LogPoller.ChaosConfig.ExperimentCount)).Msg("Done with experiment") - }() - chaosChan <- chaosPauseSyncFn(l, sethClient, testEnv.ClCluster, *testConfig.LogPoller.ChaosConfig.TargetComponent) - time.Sleep(10 * time.Second) - }() - } - - wg.Wait() - - close(chaosChan) - }() - - go func() { - var pauseData []PauseData - for result := range chaosChan { - if result.Err != nil { - l.Err(result.Err).Msg("Error encountered during chaos experiment") - errorCh <- result.Err - return // Return on actual error - } - - pauseData = append(pauseData, result.PauseData) - } - - l.Info().Msg("All chaos experiments finished") - errorCh <- nil // Only send nil once, after all errors have been handled and the channel is closed - - for _, p := range pauseData { - l.Debug().Str("Target component", p.TargetComponent).Str("Container", p.ContaineName).Str("Block range", fmt.Sprintf("%d - %d", p.StartBlock, p.EndBlock)).Msgf("Details of executed chaos pause") - } - }() -} - -// GetEndBlockToWaitFor returns the end block to wait for based on chain id and finality tag provided in config -func GetEndBlockToWaitFor(endBlock int64, network blockchain.EVMNetwork, cfg *lp_config.Config) (int64, error) { - if *cfg.General.UseFinalityTag { - return endBlock + 1, nil - } - - if network.FinalityDepth > math.MaxInt64 { - return -1, fmt.Errorf("finality depth overflows int64: %d", network.FinalityDepth) - } - return endBlock + int64(network.FinalityDepth), nil -} - -const ( - defaultAmountOfUpkeeps = 2 -) - -var ( - DefaultOCRRegistryConfig = contracts.KeeperRegistrySettings{ - PaymentPremiumPPB: uint32(200000000), - FlatFeeMicroLINK: uint32(0), - BlockCountPerTurn: big.NewInt(10), - CheckGasLimit: uint32(2500000), - StalenessSeconds: big.NewInt(90000), - GasCeilingMultiplier: uint16(1), - MinUpkeepSpend: big.NewInt(0), - MaxPerformGas: uint32(5000000), - FallbackGasPrice: big.NewInt(2e11), - FallbackLinkPrice: big.NewInt(2e18), - MaxCheckDataSize: uint32(5000), - MaxPerformDataSize: uint32(5000), - } -) - -// SetupLogPollerTestDocker starts the DON and private Ethereum network -func SetupLogPollerTestDocker( - t *testing.T, - registryVersion ethereum.KeeperRegistryVersion, - registryConfig contracts.KeeperRegistrySettings, - upkeepsNeeded int, - finalityTagEnabled bool, - testConfig *tc.TestConfig, - logScannerSettings test_env.ChainlinkNodeLogScannerSettings, -) ( - *seth.Client, - []*nodeclient.ChainlinkClient, - contracts.LinkToken, - contracts.KeeperRegistry, - contracts.KeeperRegistrar, - *test_env.CLClusterTestEnv, - *blockchain.EVMNetwork, -) { - l := logging.GetTestLogger(t) - - // Add registry version to config - registryConfig.RegistryVersion = registryVersion - network := networks.MustGetSelectedNetworkConfig(testConfig.Network)[0] - - // launch the environment - var env *test_env.CLClusterTestEnv - chainlinkNodeFunding := 0.5 - l.Debug().Msgf("Funding amount: %f", chainlinkNodeFunding) - clNodesCount := 5 - - var evmNetworkExtraSettingsFn = func(network *blockchain.EVMNetwork) *blockchain.EVMNetwork { - // we need it, because by default finality depth is 0 for our simulated network - if network.Simulated && !finalityTagEnabled { - network.FinalityDepth = 10 - } - network.FinalityTag = finalityTagEnabled - return network - } - - privateNetwork, err := actions.EthereumNetworkConfigFromConfig(l, testConfig) - require.NoError(t, err, "Error building ethereum network config") - - env, err = test_env.NewCLTestEnvBuilder(). - WithTestConfig(testConfig). - WithTestInstance(t). - WithPrivateEthereumNetwork(privateNetwork.EthereumNetworkConfig). - WithCLNodes(clNodesCount). - WithEVMNetworkOptions(evmNetworkExtraSettingsFn). - WithChainlinkNodeLogScanner(logScannerSettings). - WithStandardCleanup(). - Build() - require.NoError(t, err, "Error deploying test environment") - - evmNetwork, err := env.GetFirstEvmNetwork() - require.NoError(t, err, "Error getting first evm network") - - chainClient, err := utils.TestAwareSethClient(t, testConfig, evmNetwork) - require.NoError(t, err, "Error getting seth client") - - err = actions.FundChainlinkNodesFromRootAddress(l, chainClient, contracts.ChainlinkClientToChainlinkNodeWithKeysAndAddress(env.ClCluster.NodeAPIs()), big.NewFloat(chainlinkNodeFunding)) - require.NoError(t, err, "Failed to fund the nodes") - - nodeClients := env.ClCluster.NodeAPIs() - workerNodes := nodeClients[1:] - - linkToken, err := contracts.DeployLinkTokenContract(l, chainClient) - require.NoError(t, err, "Error deploying LINK token") - - wethToken, err := contracts.DeployWETHTokenContract(l, chainClient) - require.NoError(t, err, "Error deploying weth token contract") - - // This feed is used for both eth/usd and link/usd - ethUSDFeed, err := contracts.DeployMockETHUSDFeed(chainClient, registryConfig.FallbackLinkPrice) - require.NoError(t, err, "Error deploying eth usd feed contract") - - linkBalance, err := linkToken.BalanceOf(context.Background(), chainClient.MustGetRootKeyAddress().Hex()) - require.NoError(t, err, "Error getting LINK balance") - - l.Info().Str("Balance", big.NewInt(0).Div(linkBalance, big.NewInt(1e18)).String()).Msg("LINK balance") - minLinkBalanceSingleNode := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(9)) - minLinkBalance := big.NewInt(0).Mul(minLinkBalanceSingleNode, big.NewInt(int64(upkeepsNeeded))) - if linkBalance.Cmp(minLinkBalance) < 0 { - require.FailNowf(t, "Not enough LINK", "Not enough LINK to run the test. Need at least %s. but has only %s", big.NewInt(0).Div(minLinkBalance, big.NewInt(1e18)).String(), big.NewInt(0).Div(linkBalance, big.NewInt(1e18)).String()) - } - - registry, registrar := actions.DeployAutoOCRRegistryAndRegistrar( - t, - chainClient, - registryVersion, - registryConfig, - linkToken, - wethToken, - ethUSDFeed, - ) - - // Fund the registry with LINK - err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(defaultAmountOfUpkeeps)))) - require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - - err = actions.CreateOCRKeeperJobsLocal(l, nodeClients, registry.Address(), network.ChainID, 0, registryVersion) - require.NoError(t, err, "Error creating OCR Keeper Jobs") - ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(l, workerNodes, registryConfig, registrar.Address(), 30*time.Second, registry.RegistryOwnerAddress(), registry.ChainModuleAddress(), registry.ReorgProtectionEnabled()) - require.NoError(t, err, "Error building OCR config vars") - err = registry.SetConfigTypeSafe(ocrConfig) - require.NoError(t, err, "Registry config should be set successfully") - - return chainClient, nodeClients, linkToken, registry, registrar, env, &network -} - -// UploadLogEmitterContracts uploads the configured number of log emitter contracts -func UploadLogEmitterContracts(l zerolog.Logger, t *testing.T, client *seth.Client, testConfig *tc.TestConfig) []*contracts.LogEmitter { - logEmitters := make([]*contracts.LogEmitter, 0) - for i := 0; i < *testConfig.LogPoller.General.Contracts; i++ { - logEmitter, err := contracts.DeployLogEmitterContract(l, client) - logEmitters = append(logEmitters, &logEmitter) - require.NoError(t, err, "Error deploying log emitter contract") - l.Info().Str("Contract address", logEmitter.Address().Hex()).Msg("Log emitter contract deployed") - time.Sleep(200 * time.Millisecond) - } - - return logEmitters -} - -// AssertUpkeepIdsUniqueness asserts that the provided upkeep IDs are unique -func AssertUpkeepIdsUniqueness(upkeepIDs []*big.Int) error { - upKeepIdSeen := make(map[int64]bool) - for _, upkeepID := range upkeepIDs { - if _, ok := upKeepIdSeen[upkeepID.Int64()]; ok { - return fmt.Errorf("Duplicate upkeep ID %d", upkeepID.Int64()) - } - upKeepIdSeen[upkeepID.Int64()] = true - } - - return nil -} - -// AssertContractAddressUniquneness asserts that the provided contract addresses are unique -func AssertContractAddressUniquneness(logEmitters []*contracts.LogEmitter) error { - contractAddressSeen := make(map[string]bool) - for _, logEmitter := range logEmitters { - address := (*logEmitter).Address().String() - if _, ok := contractAddressSeen[address]; ok { - return fmt.Errorf("Duplicate contract address %s", address) - } - contractAddressSeen[address] = true - } - - return nil -} - -// RegisterFiltersAndAssertUniquness registers the configured log filters and asserts that the filters are unique -// meaning that for each log emitter address and topic there is only one filter -func RegisterFiltersAndAssertUniquness(l zerolog.Logger, registry contracts.KeeperRegistry, upkeepIDs []*big.Int, logEmitters []*contracts.LogEmitter, cfg *lp_config.Config, upKeepsNeeded int) error { - uniqueFilters := make(map[string]bool) - - upkeepIdIndex := 0 - for i := range logEmitters { - for j := 0; j < len(cfg.General.EventsToEmit); j++ { - emitterAddress := (*logEmitters[i]).Address() - topicId := cfg.General.EventsToEmit[j].ID - - upkeepID := upkeepIDs[upkeepIdIndex] - l.Debug().Int("Upkeep id", int(upkeepID.Int64())).Str("Emitter address", emitterAddress.String()).Str("Topic", topicId.Hex()).Msg("Registering log trigger for log emitter") - err := registerSingleTopicFilter(registry, upkeepID, emitterAddress, topicId) - randomWait(150, 300) - if err != nil { - return fmt.Errorf("%w: Error registering log trigger for log emitter %s", err, emitterAddress.String()) - } - - if i%10 == 0 { - l.Info().Msgf("Registered log trigger for topic %d for log emitter %d/%d", j, i, len(logEmitters)) - } - - key := fmt.Sprintf("%s-%s", emitterAddress.String(), topicId.Hex()) - if _, ok := uniqueFilters[key]; ok { - return fmt.Errorf("Duplicate filter %s", key) - } - uniqueFilters[key] = true - upkeepIdIndex++ - } - } - - if upKeepsNeeded != len(uniqueFilters) { - return fmt.Errorf("Number of unique filters should be equal to number of upkeeps. Expected %d. Got %d", upKeepsNeeded, len(uniqueFilters)) - } - - return nil -} - -// FluentlyCheckIfAllNodesHaveLogCount checks if all CL nodes have the expected log count for the provided block range and expected filters -// It will retry until the provided duration is reached or until all nodes have the expected log count -func FluentlyCheckIfAllNodesHaveLogCount(duration string, startBlock, endBlock int64, expectedLogCount int, expectedFilters []ExpectedFilter, l zerolog.Logger, coreLogger core_logger.SugaredLogger, testEnv *test_env.CLClusterTestEnv, chainId int64) (bool, error) { - logCountWaitDuration, err := time.ParseDuration(duration) - if err != nil { - return false, err - } - endTime := time.Now().Add(logCountWaitDuration) - - // not using gomega here, because I want to see which logs were missing - allNodesLogCountMatches := false - for time.Now().Before(endTime) { - logCountMatches, clErr := ClNodesHaveExpectedLogCount(startBlock, endBlock, big.NewInt(chainId), expectedLogCount, expectedFilters, l, coreLogger, testEnv.ClCluster) - if clErr != nil { - l.Warn(). - Err(clErr). - Msg("Error checking if CL nodes have expected log count. Retrying...") - } - if logCountMatches { - allNodesLogCountMatches = true - break - } - l.Warn(). - Msg("At least one CL node did not have expected log count. Retrying...") - time.Sleep(10 * time.Second) - } - - return allNodesLogCountMatches, nil -}