Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration-tests/actions/refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (r *OvershotTransferRetrier) Retry(ctx context.Context, logger zerolog.Logg
// of strategies to attempt to return funds, including retrying with less funds if the transaction fails due to
// insufficient funds, and retrying with a higher gas limit if the transaction fails due to gas too low.
func ReturnFundsFromNodes(log zerolog.Logger, client *seth.Client, chainlinkNodes []contracts.ChainlinkNodeWithKeysAndAddress) error {
var keyExporters []contracts.ChainlinkKeyExporter
keyExporters := make([]contracts.ChainlinkKeyExporter, 0, len(chainlinkNodes))
for _, node := range chainlinkNodes {
keyExporters = append(keyExporters, node)
}
Expand Down Expand Up @@ -327,7 +327,7 @@ func returnAllFundsIfPossible(log zerolog.Logger, sethClient *seth.Client, fromP

if sethClient.Cfg.IsExperimentEnabled(seth.Experiment_SlowFundsReturn) {
txPriority = "slow"
thirtyMinutes := time.Duration(30 * time.Minute)
thirtyMinutes := 30 * time.Minute
txTimeout = thirtyMinutes
}

Expand Down
11 changes: 6 additions & 5 deletions integration-tests/actions/teardown.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPa
gasPrice := big.NewInt(0)
gasFeeCap := big.NewInt(0)
gasTipCap := big.NewInt(0)
if client.Cfg.Network.EIP1559DynamicFees {
switch {
case client.Cfg.Network.EIP1559DynamicFees:
if payload.GasFeeCap == nil || payload.GasTipCap == nil {
txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit))
gasFeeCap = txOptions.GasFeeCap
Expand All @@ -92,10 +93,10 @@ func SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPa
if payload.GasTipCap != nil {
gasTipCap = payload.GasTipCap
}
} else if payload.GasPrice == nil {
case payload.GasPrice == nil:
txOptions := client.NewTXOpts(seth.WithGasLimit(gasLimit))
gasPrice = txOptions.GasPrice
} else {
default:
gasPrice = payload.GasPrice
}

Expand Down Expand Up @@ -209,11 +210,11 @@ func TeardownSuite(
chainlinkNodes []*nodeclient.ChainlinkK8sClient,
optionalTestReporter testreporters.TestReporter,
failingLogLevel zapcore.Level,
grafnaUrlProvider testreporters.GrafanaURLProvider,
grafnaURLProvider testreporters.GrafanaURLProvider,
evmClients ...blockchain.EVMClient,
) error {
l := logging.GetTestLogger(t)
if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel, grafnaUrlProvider); err != nil {
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)
Expand Down
34 changes: 17 additions & 17 deletions integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ func (n *ClNode) PrimaryETHAddress() (string, error) {
return n.API.PrimaryEthAddress()
}

func (n *ClNode) AddBootstrapJob(verifierAddr common.Address, chainId int64,
feedId [32]byte) (*nodeclient.Job, error) {
spec := it_utils.BuildBootstrapSpec(verifierAddr, chainId, feedId)
func (n *ClNode) AddBootstrapJob(verifierAddr common.Address, chainID int64,
feedID [32]byte) (*nodeclient.Job, error) {
spec := it_utils.BuildBootstrapSpec(verifierAddr, chainID, feedID)
return n.API.MustCreateJob(spec)
}

func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64, chainId int64,
feedId [32]byte, customAllowedFaults *int, bootstrapUrl string,
mercuryServerUrl string, mercuryServerPubKey string,
func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64, chainID int64,
feedID [32]byte, customAllowedFaults *int, bootstrapURL string,
mercuryServerURL string, mercuryServerPubKey string,
eaUrls []*url.URL) (*nodeclient.Job, error) {
csaKeys, _, err := n.API.ReadCSAKeys()
if err != nil {
Expand All @@ -170,10 +170,10 @@ func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64,
return nil, err
}

var nodeOCRKeyId []string
var nodeOCRKeyID []string
for _, key := range nodeOCRKeys.Data {
if key.Attributes.ChainType == string(corekeys.EVM) {
nodeOCRKeyId = append(nodeOCRKeyId, key.ID)
nodeOCRKeyID = append(nodeOCRKeyID, key.ID)
break
}
}
Expand All @@ -194,9 +194,9 @@ func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64,
}

spec := it_utils.BuildOCRSpec(
verifierAddr, chainId, fromBlock, feedId, bridges,
csaPubKey, mercuryServerUrl, mercuryServerPubKey, nodeOCRKeyId[0],
bootstrapUrl, allowedFaults)
verifierAddr, chainID, fromBlock, feedID, bridges,
csaPubKey, mercuryServerURL, mercuryServerPubKey, nodeOCRKeyID[0],
bootstrapURL, allowedFaults)

return n.API.MustCreateJob(spec)
}
Expand All @@ -213,14 +213,14 @@ func (n *ClNode) GetAPIClient() *nodeclient.ChainlinkClient {
return n.API
}

func (n *ClNode) GetPeerUrl() (string, error) {
func (n *ClNode) GetPeerURL() (string, error) {
p2pKeys, err := n.API.MustReadP2PKeys()
if err != nil {
return "", err
}
p2pId := p2pKeys.Data[0].Attributes.PeerID
p2pID := p2pKeys.Data[0].Attributes.PeerID

return fmt.Sprintf("%s@%s:%d", p2pId, n.GetContainerName(), 6690), nil
return fmt.Sprintf("%s@%s:%d", p2pID, n.GetContainerName(), 6690), nil
}

func (n *ClNode) GetNodeCSAKeys() (*nodeclient.CSAKeys, error) {
Expand Down Expand Up @@ -312,7 +312,7 @@ func (n *ClNode) containerStartOrRestart(restartDb bool) error {
return fmt.Errorf("%s err: %w", ErrConnectNodeClient, err)
}

graphqlClient, err := newChainLinkGraphqlClient(config)
graphqlClient, err := newChainLinkGraphqlClient(testcontext.Get(n.t), config)
if err != nil {
return fmt.Errorf("%s err: %w", ErrConnectNodeGraphqlClient, err)
}
Expand Down Expand Up @@ -453,8 +453,8 @@ func (n *ClNode) getContainerRequest(secrets string) (
}, nil
}

func newChainLinkGraphqlClient(c *nodeclient.ChainlinkConfig) (grapqlClient.Client, error) {
nodeClient, err := grapqlClient.New(c.URL, grapqlClient.Credentials{Email: c.Email, Password: c.Password})
func newChainLinkGraphqlClient(ctx context.Context, c *nodeclient.ChainlinkConfig) (grapqlClient.Client, error) {
nodeClient, err := grapqlClient.NewWithContext(ctx, c.URL, grapqlClient.Credentials{Email: c.Email, Password: c.Password})
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/docker/test_env/cl_node_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *ClCluster) Stop() error {
}

func (c *ClCluster) NodeAPIs() []*nodeclient.ChainlinkClient {
clients := make([]*nodeclient.ChainlinkClient, 0)
clients := make([]*nodeclient.ChainlinkClient, 0, len(c.Nodes))
for _, c := range c.Nodes {
clients = append(clients, c.API)
}
Expand Down
29 changes: 8 additions & 21 deletions integration-tests/docker/test_env/test_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package test_env
import (
"errors"
"fmt"
"path/filepath"
"runtime"
"testing"

"github.com/rs/zerolog"
Expand Down Expand Up @@ -208,17 +206,6 @@ func (te *CLClusterTestEnv) Cleanup(opts CleanupOpts) error {
return nil
}

// getChainlinkDir returns the path to the chainlink directory
func getChainlinkDir() (string, error) {
_, filename, _, ok := runtime.Caller(1)
if !ok {
return "", errors.New("cannot determine the path of the calling file")
}
dir := filepath.Dir(filename)
chainlinkDir := filepath.Clean(filepath.Join(dir, "../../.."))
return chainlinkDir, nil
}

func (te *CLClusterTestEnv) logWhetherAllContainersAreRunning() {
for _, node := range te.ClCluster.Nodes {
if node.Container == nil {
Expand All @@ -238,13 +225,13 @@ func (te *CLClusterTestEnv) logWhetherAllContainersAreRunning() {
}
}

// GetRpcProvider retrieves the RPC node for the specified chain
func (te *CLClusterTestEnv) GetRpcProvider(chainId int64) (*test_env.RpcProvider, error) {
if rpc, ok := te.rpcProviders[chainId]; ok {
// GetRPCProvider retrieves the RPC node for the specified chain
func (te *CLClusterTestEnv) GetRPCProvider(chainID int64) (*test_env.RpcProvider, error) {
if rpc, ok := te.rpcProviders[chainID]; ok {
return rpc, nil
}

return nil, fmt.Errorf("no RPC provider available for chain ID %d", chainId)
return nil, fmt.Errorf("no RPC provider available for chain ID %d", chainID)
}

// GetFirstEvmNetwork retrieves the first EVM network available in the test environment
Expand All @@ -256,13 +243,13 @@ func (te *CLClusterTestEnv) GetFirstEvmNetwork() (*blockchain.EVMNetwork, error)
return te.EVMNetworks[0], nil
}

// GetEVMNetworkForChainId retrieves the EVM network for the specified chain ID
func (te *CLClusterTestEnv) GetEVMNetworkForChainId(chainId int64) (*blockchain.EVMNetwork, error) {
// GetEVMNetworkForChainID retrieves the EVM network for the specified chain ID
func (te *CLClusterTestEnv) GetEVMNetworkForChainID(chainID int64) (*blockchain.EVMNetwork, error) {
for _, network := range te.EVMNetworks {
if network.ChainID == chainId {
if network.ChainID == chainID {
return network, nil
}
}

return nil, fmt.Errorf("no EVM network available for chain ID %d", chainId)
return nil, fmt.Errorf("no EVM network available for chain ID %d", chainID)
}
12 changes: 7 additions & 5 deletions integration-tests/docker/test_env/test_env_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ var DefaultChainlinkNodeLogScannerSettings = ChainlinkNodeLogScannerSettings{
}

func GetDefaultChainlinkNodeLogScannerSettingsWithExtraAllowedMessages(extraAllowedMessages ...testreporters.AllowedLogMessage) ChainlinkNodeLogScannerSettings {
allowedMessages := append(DefaultAllowedMessages, extraAllowedMessages...)
allowedMessages := make([]testreporters.AllowedLogMessage, 0, len(DefaultAllowedMessages)+len(extraAllowedMessages))
allowedMessages = append(allowedMessages, DefaultAllowedMessages...)
allowedMessages = append(allowedMessages, extraAllowedMessages...)
return ChainlinkNodeLogScannerSettings{
FailingLogLevel: DefaultChainlinkNodeLogScannerSettings.FailingLogLevel,
Threshold: DefaultChainlinkNodeLogScannerSettings.Threshold,
Expand Down Expand Up @@ -529,12 +531,12 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) {
for _, en := range b.te.EVMNetworks {
network := *en
if en.Simulated {
if rpcs, ok := b.te.rpcProviders[network.ChainID]; ok {
network.HTTPURLs = rpcs.PrivateHttpUrls()
network.URLs = rpcs.PrivateWsUrsl()
} else {
rpcs, ok := b.te.rpcProviders[network.ChainID]
if !ok {
return nil, fmt.Errorf("rpc provider for chain %d not found", network.ChainID)
}
network.HTTPURLs = rpcs.PrivateHttpUrls()
network.URLs = rpcs.PrivateWsUrsl()
}
dereferrencedEvms = append(dereferrencedEvms, network)
}
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/docker/test_env/test_env_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewTestEnvConfigFromFile(path string) (*TestEnvConfig, error) {
return c, nil
}

func (c *TestEnvConfig) Json() string {
func (c *TestEnvConfig) JSON() string {
b, _ := json.Marshal(c)
return string(b)
}
21 changes: 14 additions & 7 deletions integration-tests/load/ccip/aptos_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func fundAptosAccount(t *testing.T, signer aptos.TransactionSigner, to aptos.Acc
t.Logf("Funded account %s from %s with %f APT", to.StringLong(), sender.StringLong(), float64(amount)/1e8)
}

//nolint:unused // Can be removed by ccip aptos devs if they no longer require this function
func fundAdditionalAptosKeys(
t *testing.T,
signer aptos.TransactionSigner,
Expand Down Expand Up @@ -91,6 +92,7 @@ func fundAdditionalAptosKeys(
return funded, nil
}

//nolint:unused // Can be removed by ccip aptos devs if they no longer require this function
func fundAptosLoadAccountsWithBnM(
lggr logger.Logger,
e cldf.Environment,
Expand All @@ -101,7 +103,7 @@ func fundAptosLoadAccountsWithBnM(
"chain", aptosChainSelector,
"numAccounts", len(loadAccounts))

addresses, err := e.ExistingAddresses.AddressesForChain(aptosChainSelector)
addresses, err := e.ExistingAddresses.AddressesForChain(aptosChainSelector) //nolint:staticcheck // SA1019 AddressBook is deprecated
if err != nil {
return fmt.Errorf("failed to get addresses for chain %d: %w", aptosChainSelector, err)
}
Expand Down Expand Up @@ -185,6 +187,7 @@ func fundAptosLoadAccountsWithBnM(
return nil
}

//nolint:unused // Can be removed by ccip aptos devs if they no longer require this function
func subscribeAptosTransmitEvents(
ctx context.Context,
t *testing.T,
Expand Down Expand Up @@ -304,9 +307,9 @@ func subscribeAptosTransmitEvents(

report := finalSeqNrReport{
sourceChainSelector: csPair.SourceChainSelector,
expectedSeqNrRange: ccipocr3.SeqNumRange{
ccipocr3.SeqNum(seqNumRange.Start.Load()),
ccipocr3.SeqNum(seqNumRange.End.Load()),
expectedSeqNrRange: ccipocr3.SeqNumRange{ //nolint:staticcheck // SA1019 not migrating to ccipocr3common yet
ccipocr3.SeqNum(seqNumRange.Start.Load()), //nolint:staticcheck // SA1019 not migrating to ccipocr3common yet
ccipocr3.SeqNum(seqNumRange.End.Load()), //nolint:staticcheck // SA1019 not migrating to ccipocr3common yet
},
}

Expand All @@ -318,6 +321,7 @@ func subscribeAptosTransmitEvents(
}
}

//nolint:unused // Can be removed by ccip aptos devs if they no longer require this function
func subscribeAptosCommitEvents(
ctx context.Context,
t *testing.T,
Expand All @@ -341,7 +345,7 @@ func subscribeAptosCommitEvents(

// Track seen messages and expected ranges
seenMessages := make(map[uint64][]uint64)
expectedRange := make(map[uint64]ccipocr3.SeqNumRange)
expectedRange := make(map[uint64]ccipocr3.SeqNumRange) //nolint:staticcheck // SA1019 not migrating to ccipocr3common yet
completedSrcChains := make(map[uint64]bool)

for _, srcChain := range srcChains {
Expand Down Expand Up @@ -388,7 +392,9 @@ func subscribeAptosCommitEvents(
report := eventWithVersion.Event

// Process both blessed and unblessed merkle roots
allRoots := append(report.BlessedMerkleRoots, report.UnblessedMerkleRoots...)
allRoots := make([]module_offramp.MerkleRoot, 0, len(report.BlessedMerkleRoots)+len(report.UnblessedMerkleRoots))
allRoots = append(allRoots, report.BlessedMerkleRoots...)
allRoots = append(allRoots, report.UnblessedMerkleRoots...)
for _, mr := range allRoots {
// Push metrics for each sequence number in the range
for i := mr.MinSeqNr; i <= mr.MaxSeqNr; i++ {
Expand Down Expand Up @@ -461,6 +467,7 @@ func subscribeAptosCommitEvents(
}
}

//nolint:unused // Can be removed by ccip aptos devs if they no longer require this function
func subscribeAptosExecutionEvents(
ctx context.Context,
t *testing.T,
Expand All @@ -484,7 +491,7 @@ func subscribeAptosExecutionEvents(

// Track seen messages and expected ranges
seenMessages := make(map[uint64][]uint64)
expectedRange := make(map[uint64]ccipocr3.SeqNumRange)
expectedRange := make(map[uint64]ccipocr3.SeqNumRange) //nolint:staticcheck // SA1019 not migrating to ccipocr3common yet
completedSrcChains := make(map[uint64]bool)

for _, srcChain := range srcChains {
Expand Down
12 changes: 8 additions & 4 deletions integration-tests/load/ccip/ccip_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/rpc"
Expand Down Expand Up @@ -56,7 +55,8 @@ func runRealisticRPCLatencySuite(t *testing.T, testDuration, latency, jitter tim
config, cr, _ := prepareChaos(t)
cfg := config.Chaos

labelValues := []string{"geth-1337", "geth-2337"}
labelValues := make([]string, 0, 2+(numChains-2))
labelValues = append(labelValues, "geth-1337", "geth-2337")
for i := range numChains - 2 {
labelValues = append(labelValues, fmt.Sprintf("geth-%d", 90000001+i))
}
Expand Down Expand Up @@ -110,10 +110,14 @@ type cribNetworkConfig []struct {
func readCRIBConfig(t *testing.T, cfg *ccip.Config) cribNetworkConfig {
t.Helper()
f, err := os.ReadFile(*cfg.Load.CribEnvDirectory + "/ccip-v2-scripts-chains-details.json")
require.NoError(t, err, "Failed to read CRIB config file")
if !assert.NoError(t, err, "Failed to read CRIB config file") { //nolint:testifylint // go-require: this runs in a goroutine via runFullChaosSuite, so require is unsafe here
return nil
}
var cribConfig cribNetworkConfig
err = json.Unmarshal(f, &cribConfig)
require.NoError(t, err, "Failed to unmarshal CRIB config")
if !assert.NoError(t, err, "Failed to unmarshal CRIB config") {
return nil
}
return cribConfig
}

Expand Down
Loading
Loading