Skip to content

Commit

Permalink
use Seth Network urls if provided, otherwise take url from evmnetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Apr 2, 2024
1 parent 95e388a commit d9b5d6e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
39 changes: 39 additions & 0 deletions integration-tests/experiments/gas_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package experiments

import (
"testing"
"time"

"github.com/smartcontractkit/seth"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig"
"github.com/smartcontractkit/chainlink/integration-tests/utils"
)

func TestGasExperiment(t *testing.T) {
l := logging.GetTestLogger(t)
config, err := tc.GetConfig("Soak", tc.OCR)
require.NoError(t, err, "Error getting config")

network := networks.MustGetSelectedNetworkConfig(config.GetNetworkConfig())[0]
readSethCfg := config.GetSethConfig()
require.NotNil(t, readSethCfg, "Seth config shouldn't be nil")

sethCfg, err := utils.MergeSethAndEvmNetworkConfigs(network, *readSethCfg)
require.NoError(t, err, "Error merging seth and evm network configs")
err = utils.ValidateSethNetworkConfig(sethCfg.Network)
require.NoError(t, err, "Error validating seth network config")

seth, err := seth.NewClientWithConfig(&sethCfg)
require.NoError(t, err, "Error creating seth client")

for i := 0; i < 1; i++ {
_, err = contracts.DeployLinkTokenContract(l, seth)
require.NoError(t, err, "Error deploying LINK contract")
time.Sleep(2 * time.Second)
}
}
8 changes: 6 additions & 2 deletions integration-tests/utils/seth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func MergeSethAndEvmNetworkConfigs(evmNetwork blockchain.EVMNetwork, sethConfig
if evmNetwork.Simulated {
if conf.Name == seth.GETH {
conf.PrivateKeys = evmNetwork.PrivateKeys
conf.URLs = evmNetwork.URLs
if len(conf.URLs) == 0 {
conf.URLs = evmNetwork.URLs
}
// important since Besu doesn't support EIP-1559, but other EVM clients do
conf.EIP1559DynamicFees = evmNetwork.SupportsEIP1559

Expand All @@ -35,7 +37,9 @@ func MergeSethAndEvmNetworkConfigs(evmNetwork blockchain.EVMNetwork, sethConfig
}
} else if conf.ChainID == fmt.Sprint(evmNetwork.ChainID) {
conf.PrivateKeys = evmNetwork.PrivateKeys
conf.URLs = evmNetwork.URLs
if len(conf.URLs) == 0 {
conf.URLs = evmNetwork.URLs
}

sethNetwork = conf
break
Expand Down

0 comments on commit d9b5d6e

Please sign in to comment.