From da8cd670ac2ea818f56aef81f26c954495e1b82c Mon Sep 17 00:00:00 2001 From: FelixFan1992 Date: Mon, 19 Feb 2024 13:23:20 -0500 Subject: [PATCH] fix sonarqube --- .../contracts/ethereum_keeper_contracts.go | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go index 1594879d2c1..1285b6b8cee 100644 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ b/integration-tests/contracts/ethereum_keeper_contracts.go @@ -271,29 +271,7 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr return nil, err } - onchainConfigStruct := automation_registry_wrapper_2_2.AutomationRegistryBase22OnchainConfig{ - PaymentPremiumPPB: rcs.PaymentPremiumPPB, - FlatFeeMicroLink: rcs.FlatFeeMicroLINK, - CheckGasLimit: rcs.CheckGasLimit, - StalenessSeconds: rcs.StalenessSeconds, - GasCeilingMultiplier: rcs.GasCeilingMultiplier, - MinUpkeepSpend: rcs.MinUpkeepSpend, - MaxPerformGas: rcs.MaxPerformGas, - MaxCheckDataSize: rcs.MaxCheckDataSize, - MaxPerformDataSize: rcs.MaxPerformDataSize, - MaxRevertDataSize: uint32(1000), - FallbackGasPrice: rcs.FallbackGasPrice, - FallbackLinkPrice: rcs.FallbackLinkPrice, - Transcoder: common.Address{}, - Registrars: []common.Address{common.HexToAddress(registrar)}, - UpkeepPrivilegeManager: registryOwnerAddress, - ChainModule: *chainModuleBaseAddr, - ReorgProtectionEnabled: true, - } - - encodedOnchainConfig, err := utilsABI22.Methods["_onChainConfig"].Inputs.Pack(&onchainConfigStruct) - - return encodedOnchainConfig, err + return rcs.encode22OnchainConfig(registrar, registryOwnerAddress, *chainModuleBaseAddr) } configType := goabi.MustNewType("tuple(uint32 paymentPremiumPPB,uint32 flatFeeMicroLink,uint32 checkGasLimit,uint24 stalenessSeconds,uint16 gasCeilingMultiplier,uint96 minUpkeepSpend,uint32 maxPerformGas,uint32 maxCheckDataSize,uint32 maxPerformDataSize,uint256 fallbackGasPrice,uint256 fallbackLinkPrice,address transcoder,address registrar)") onchainConfig, err := goabi.Encode(map[string]interface{}{ @@ -315,6 +293,32 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr } +func (rcs *KeeperRegistrySettings) encode22OnchainConfig(registrar string, registryOwnerAddress, chainModuleBaseAddr common.Address) ([]byte, error) { + onchainConfigStruct := automation_registry_wrapper_2_2.AutomationRegistryBase22OnchainConfig{ + PaymentPremiumPPB: rcs.PaymentPremiumPPB, + FlatFeeMicroLink: rcs.FlatFeeMicroLINK, + CheckGasLimit: rcs.CheckGasLimit, + StalenessSeconds: rcs.StalenessSeconds, + GasCeilingMultiplier: rcs.GasCeilingMultiplier, + MinUpkeepSpend: rcs.MinUpkeepSpend, + MaxPerformGas: rcs.MaxPerformGas, + MaxCheckDataSize: rcs.MaxCheckDataSize, + MaxPerformDataSize: rcs.MaxPerformDataSize, + MaxRevertDataSize: uint32(1000), + FallbackGasPrice: rcs.FallbackGasPrice, + FallbackLinkPrice: rcs.FallbackLinkPrice, + Transcoder: common.Address{}, + Registrars: []common.Address{common.HexToAddress(registrar)}, + UpkeepPrivilegeManager: registryOwnerAddress, + ChainModule: chainModuleBaseAddr, + ReorgProtectionEnabled: true, + } + + encodedOnchainConfig, err := utilsABI22.Methods["_onChainConfig"].Inputs.Pack(&onchainConfigStruct) + + return encodedOnchainConfig, err +} + func (v *EthereumKeeperRegistry) RegistryOwnerAddress() common.Address { callOpts := &bind.CallOpts{ Pending: false,