diff --git a/.dockerignore b/.dockerignore index 4bbd79b7a96..c7f58621aa2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -30,3 +30,6 @@ codeship-*.yml dockercfg credentials.env gcr_creds.env + +go.work +go.work.sum \ No newline at end of file diff --git a/integration-tests/actions/seth/actions.go b/integration-tests/actions/seth/actions.go index 8de166f0fce..79ef6edb357 100644 --- a/integration-tests/actions/seth/actions.go +++ b/integration-tests/actions/seth/actions.go @@ -116,7 +116,7 @@ func SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPa return nil, err } - gasLimit := uint64(client.Cfg.Network.GasLimit) + gasLimit := uint64(client.Cfg.Network.TransferGasFee) if payload.GasLimit != nil { gasLimit = *payload.GasLimit } diff --git a/integration-tests/actions/seth/refund.go b/integration-tests/actions/seth/refund.go index e0f82f18aa1..4b267ffeeb9 100644 --- a/integration-tests/actions/seth/refund.go +++ b/integration-tests/actions/seth/refund.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/pkg/errors" "github.com/rs/zerolog" @@ -50,7 +51,7 @@ func (r *InsufficientFundTransferRetrier) Retry(ctx context.Context, logger zero if r.nextRetrier != nil { logger.Debug(). Str("retier", "InsufficientFundTransferRetrier"). - Msg("Max gas limit reached. Passing to next retrier") + Msg("Max retries reached. Passing to next retrier") return r.nextRetrier.Retry(ctx, logger, client, txErr, payload, 0) } return txErr @@ -241,6 +242,8 @@ func ReturnFunds(log zerolog.Logger, seth *seth.Client, chainlinkNodes []contrac return nil } + failedReturns := []common.Address{} + for _, chainlinkNode := range chainlinkNodes { fundedKeys, err := chainlinkNode.ExportEVMKeysForChain(fmt.Sprint(seth.ChainID)) if err != nil { @@ -272,9 +275,9 @@ func ReturnFunds(log zerolog.Logger, seth *seth.Client, chainlinkNodes []contrac var totalGasCost *big.Int if seth.Cfg.Network.EIP1559DynamicFees { - totalGasCost = new(big.Int).Mul(big.NewInt(0).SetUint64(seth.Cfg.Network.GasLimit), big.NewInt(0).SetInt64(seth.Cfg.Network.GasFeeCap)) + totalGasCost = new(big.Int).Mul(big.NewInt(0).SetInt64(seth.Cfg.Network.TransferGasFee), big.NewInt(0).SetInt64(seth.Cfg.Network.GasFeeCap)) } else { - totalGasCost = new(big.Int).Mul(big.NewInt(0).SetUint64(seth.Cfg.Network.GasLimit), big.NewInt(0).SetInt64(seth.Cfg.Network.GasPrice)) + totalGasCost = new(big.Int).Mul(big.NewInt(0).SetInt64(seth.Cfg.Network.TransferGasFee), big.NewInt(0).SetInt64(seth.Cfg.Network.GasPrice)) } toSend := new(big.Int).Sub(balance, totalGasCost) @@ -286,17 +289,33 @@ func ReturnFunds(log zerolog.Logger, seth *seth.Client, chainlinkNodes []contrac Str("Balance", balance.String()). Str("To send", toSend.String()). Msg("Not enough balance to cover gas cost. Skipping return.") + + failedReturns = append(failedReturns, fromAddress) + continue } payload := FundsToSendPayload{ToAddress: seth.Addresses[0], Amount: toSend, PrivateKey: decryptedKey.PrivateKey} _, err = SendFunds(log, seth, payload) if err != nil { - handler := OvershotTransferRetrier{maxRetries: 3, nextRetrier: &InsufficientFundTransferRetrier{maxRetries: 3, nextRetrier: &GasTooLowTransferRetrier{maxGasLimit: seth.Cfg.Network.GasLimit * 3}}} - return handler.Retry(context.Background(), log, seth, err, payload, 0) + handler := OvershotTransferRetrier{maxRetries: 10, nextRetrier: &InsufficientFundTransferRetrier{maxRetries: 10, nextRetrier: &GasTooLowTransferRetrier{maxGasLimit: uint64(seth.Cfg.Network.TransferGasFee * 10)}}} + err = handler.Retry(context.Background(), log, seth, err, payload, 0) + if err != nil { + log.Error(). + Err(err). + Str("Address", fromAddress.String()). + Msg("Failed to return funds from Chainlink node to default network wallet") + failedReturns = append(failedReturns, fromAddress) + } } } } + if len(failedReturns) > 0 { + return fmt.Errorf("failed to return funds from Chainlink nodes to default network wallet for addresses: %v", failedReturns) + } + + log.Info().Msg("Successfully returned funds from all Chainlink nodes to default network wallets") + return nil }