Skip to content

Commit

Permalink
Added Gnosis Chiado to benchmark tests (#11869)
Browse files Browse the repository at this point in the history
* Added Gnosis Chiado to benchmark tests

* Added Gnosis Chiado to benchmark tests

* Added Gnosis Chiado to benchmark tests

* fix

* set readOnlyAddress for gnosis

* add default network config in benchmark test

* clean mode selection

* run lint

---------

Co-authored-by: anirudhwarrier <[email protected]>
  • Loading branch information
smickovskid and anirudhwarrier authored Mar 1, 2024
1 parent 91a0450 commit 1598a6b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
13 changes: 12 additions & 1 deletion integration-tests/benchmark/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ type NetworkConfig struct {
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()
Expand Down Expand Up @@ -237,7 +243,7 @@ func getNetworkConfig(networkName string, config *tc.TestConfig) NetworkConfig {
var nc NetworkConfig
var ok bool
if nc, ok = networkConfig[networkName]; !ok {
return NetworkConfig{}
return defaultNetworkConfig
}

if networkName == "SimulatedGeth" || networkName == "geth" {
Expand Down Expand Up @@ -302,6 +308,11 @@ var networkConfig = map[string]NetworkConfig{
blockTime: time.Second,
deltaStage: 20 * time.Second,
},
"GnosisChiado": {
upkeepSLA: int64(120),
blockTime: 6 * time.Second,
deltaStage: 20 * time.Second,
},
}

func SetupAutomationBenchmarkEnv(t *testing.T, keeperTestConfig types.KeeperBenchmarkTestConfig) (*environment.Environment, blockchain.EVMNetwork) {
Expand Down
25 changes: 12 additions & 13 deletions integration-tests/contracts/contract_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"strings"
"time"

"github.com/smartcontractkit/chainlink-testing-framework/networks"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -956,18 +958,13 @@ func (e *EthereumContractDeployer) DeployKeeperRegistry(
var mode uint8
switch e.client.GetChainID().Int64() {
//Arbitrum payment model
//Goerli Arbitrum
case 421613:
mode = uint8(1)
//Sepolia Arbitrum
case 421614:
case networks.ArbitrumMainnet.ChainID, networks.ArbitrumSepolia.ChainID:
mode = uint8(1)
//Optimism payment model
//Goerli Optimism
case 420:
case networks.OptimismMainnet.ChainID, networks.OptimismSepolia.ChainID:
mode = uint8(2)
//Goerli Base
case 84531:
//Base
case networks.BaseMainnet.ChainID, networks.BaseSepolia.ChainID:
mode = uint8(2)
default:
mode = uint8(0)
Expand Down Expand Up @@ -1227,21 +1224,21 @@ func (e *EthereumContractDeployer) DeployKeeperRegistry(
var err error
chainId := e.client.GetChainID().Int64()

if chainId == 534352 || chainId == 534351 { // Scroll / Scroll Sepolia
if chainId == networks.ScrollMainnet.ChainID || chainId == networks.ScrollSepolia.ChainID {
chainModuleAddr, _, _, err = e.client.DeployContract("ScrollModule", func(
auth *bind.TransactOpts,
backend bind.ContractBackend,
) (common.Address, *types.Transaction, interface{}, error) {
return scroll_module.DeployScrollModule(auth, backend)
})
} else if chainId == 42161 || chainId == 421614 || chainId == 421613 { // Arbitrum One / Sepolia / Goerli
} else if chainId == networks.ArbitrumMainnet.ChainID || chainId == networks.ArbitrumSepolia.ChainID {
chainModuleAddr, _, _, err = e.client.DeployContract("ArbitrumModule", func(
auth *bind.TransactOpts,
backend bind.ContractBackend,
) (common.Address, *types.Transaction, interface{}, error) {
return arbitrum_module.DeployArbitrumModule(auth, backend)
})
} else if chainId == 10 || chainId == 11155420 { // Optimism / Optimism Sepolia
} else if chainId == networks.OptimismMainnet.ChainID || chainId == networks.OptimismSepolia.ChainID {
chainModuleAddr, _, _, err = e.client.DeployContract("OptimismModule", func(
auth *bind.TransactOpts,
backend bind.ContractBackend,
Expand Down Expand Up @@ -1269,8 +1266,10 @@ func (e *EthereumContractDeployer) DeployKeeperRegistry(
}

var allowedReadOnlyAddress common.Address
if chainId == 1101 || chainId == 1442 || chainId == 2442 {
if chainId == networks.PolygonZkEvmMainnet.ChainID || chainId == networks.PolygonZkEvmCardona.ChainID {
allowedReadOnlyAddress = common.HexToAddress("0x1111111111111111111111111111111111111111")
} else if chainId == networks.GnosisMainnet.ChainID || chainId == networks.GnosisChiado.ChainID {
allowedReadOnlyAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
} else {
allowedReadOnlyAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")
}
Expand Down

0 comments on commit 1598a6b

Please sign in to comment.