Skip to content

Commit

Permalink
refactor link transfer (#10373)
Browse files Browse the repository at this point in the history
* refactor link transfer

* update benchmark test

---------

Co-authored-by: Anirudh Warrier <anirudhwarrier@users.noreply.github.com>
  • Loading branch information
shileiwill and anirudhwarrier authored Sep 1, 2023
1 parent 98cb209 commit feb86e4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
6 changes: 0 additions & 6 deletions integration-tests/actions/automation_ocr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,11 @@ func DeployAutoOCRRegistryAndRegistrar(
t *testing.T,
registryVersion ethereum.KeeperRegistryVersion,
registrySettings contracts.KeeperRegistrySettings,
numberOfUpkeeps int,
linkToken contracts.LinkToken,
contractDeployer contracts.ContractDeployer,
client blockchain.EVMClient,
) (contracts.KeeperRegistry, contracts.KeeperRegistrar) {
registry := deployRegistry(t, registryVersion, registrySettings, contractDeployer, client, linkToken)

// 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")

registrar := deployRegistrar(t, registryVersion, registry, linkToken, contractDeployer, client)

return registry, registrar
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/chaos/automation_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,15 @@ func TestAutomationChaos(t *testing.T) {
t,
eth_contracts.RegistryVersion_2_0,
defaultOCRRegistryConfig,
numberOfUpkeeps,
linkToken,
contractDeployer,
chainClient,
)

// Fund the registry with LINK
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")

actions.CreateOCRKeeperJobs(t, chainlinkNodes, registry.Address(), network.ChainID, 0, eth_contracts.RegistryVersion_2_0)
nodesWithoutBootstrap := chainlinkNodes[1:]
ocrConfig, err := actions.BuildAutoOCR2ConfigVars(t, nodesWithoutBootstrap, defaultOCRRegistryConfig, registrar.Address(), 5*time.Second)
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/reorg/automation_reorg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,15 @@ func TestAutomationReorg(t *testing.T) {
t,
ethereum.RegistryVersion_2_0,
defaultOCRRegistryConfig,
numberOfUpkeeps,
linkToken,
contractDeployer,
chainClient,
)

// Fund the registry with LINK
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")

actions.CreateOCRKeeperJobs(t, chainlinkNodes, registry.Address(), network.ChainID, 0, ethereum.RegistryVersion_2_0)
nodesWithoutBootstrap := chainlinkNodes[1:]
ocrConfig, err := actions.BuildAutoOCR2ConfigVars(t, nodesWithoutBootstrap, defaultOCRRegistryConfig, registrar.Address(), 5*time.Second)
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/smoke/automation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,12 +916,15 @@ func setupAutomationTest(
t,
registryVersion,
registryConfig,
defaultAmountOfUpkeeps,
linkToken,
contractDeployer,
chainClient,
)

// 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")

actions.CreateOCRKeeperJobs(t, chainlinkNodes, registry.Address(), network.ChainID, 0, registryVersion)
nodesWithoutBootstrap := chainlinkNodes[1:]
ocrConfig, err := actions.BuildAutoOCR2ConfigVars(t, nodesWithoutBootstrap, registryConfig, registrar.Address(), 5*time.Second)
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/testsetups/keeper_benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,11 @@ func (k *KeeperBenchmarkTest) DeployBenchmarkKeeperContracts(
registrar = actions.DeployKeeperRegistrar(t, registryVersion, k.linkToken, registrarSettings, k.contractDeployer, k.chainClient, registry)
} else { // OCR automation - v2.X
registry, registrar = actions.DeployAutoOCRRegistryAndRegistrar(
t, registryVersion, *k.Inputs.KeeperRegistrySettings, k.Inputs.Upkeeps.NumberOfUpkeeps, k.linkToken, k.contractDeployer, k.chainClient)
t, registryVersion, *k.Inputs.KeeperRegistrySettings, k.linkToken, k.contractDeployer, k.chainClient)

// Fund the registry with LINK
err := k.linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(k.Inputs.Upkeeps.NumberOfUpkeeps))))
require.NoError(t, err, "Funding keeper registry contract shouldn't fail")
ocrConfig, err := actions.BuildAutoOCR2ConfigVars(t, k.chainlinkNodes[1:], *k.Inputs.KeeperRegistrySettings, registrar.Address(), k.Inputs.DeltaStage)
l.Debug().Interface("KeeperRegistrySettings", *k.Inputs.KeeperRegistrySettings).Interface("OCRConfig", ocrConfig).Msg("Config")
require.NoError(t, err, "Error building OCR config vars")
Expand Down

0 comments on commit feb86e4

Please sign in to comment.