Skip to content

Commit

Permalink
config cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhwarrier committed Sep 18, 2024
1 parent 646d074 commit e8bfa58
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 232 deletions.
39 changes: 38 additions & 1 deletion integration-tests/actions/automation_ocr_helpers_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/store/models"
)

func AutomationDefaultRegistryConfig(c tc.AutomationTestConfig) contracts.KeeperRegistrySettings {
func ReadRegistryConfig(c tc.AutomationTestConfig) contracts.KeeperRegistrySettings {
registrySettings := c.GetAutomationConfig().AutomationConfig.RegistrySettings
return contracts.KeeperRegistrySettings{
PaymentPremiumPPB: *registrySettings.PaymentPremiumPPB,
Expand All @@ -40,12 +40,49 @@ func AutomationDefaultRegistryConfig(c tc.AutomationTestConfig) contracts.Keeper
MaxPerformGas: *registrySettings.MaxPerformGas,
FallbackGasPrice: registrySettings.FallbackGasPrice,
FallbackLinkPrice: registrySettings.FallbackLinkPrice,
FallbackNativePrice: registrySettings.FallbackNativePrice,
MaxCheckDataSize: *registrySettings.MaxCheckDataSize,
MaxPerformDataSize: *registrySettings.MaxPerformDataSize,
MaxRevertDataSize: *registrySettings.MaxRevertDataSize,
}
}

func ReadPluginConfig(c tc.AutomationTestConfig) ocr2keepers30config.OffchainConfig {
plCfg := c.GetAutomationConfig().AutomationConfig.PluginConfig
return ocr2keepers30config.OffchainConfig{
TargetProbability: *plCfg.TargetProbability,
TargetInRounds: *plCfg.TargetInRounds,
PerformLockoutWindow: *plCfg.PerformLockoutWindow,
GasLimitPerReport: *plCfg.GasLimitPerReport,
GasOverheadPerUpkeep: *plCfg.GasOverheadPerUpkeep,
MinConfirmations: *plCfg.MinConfirmations,
MaxUpkeepBatchSize: *plCfg.MaxUpkeepBatchSize,
LogProviderConfig: ocr2keepers30config.LogProviderConfig{
BlockRate: *plCfg.LogProviderConfig.BlockRate,
LogLimit: *plCfg.LogProviderConfig.LogLimit,
},
}
}

func ReadPublicConfig(c tc.AutomationTestConfig) ocr3.PublicConfig {
pubCfg := c.GetAutomationConfig().AutomationConfig.PublicConfig
return ocr3.PublicConfig{
DeltaProgress: *pubCfg.DeltaProgress,
DeltaResend: *pubCfg.DeltaResend,
DeltaInitial: *pubCfg.DeltaInitial,
DeltaRound: *pubCfg.DeltaRound,
DeltaGrace: *pubCfg.DeltaGrace,
DeltaCertifiedCommitRequest: *pubCfg.DeltaCertifiedCommitRequest,
DeltaStage: *pubCfg.DeltaStage,
RMax: *pubCfg.RMax,
MaxDurationQuery: *pubCfg.MaxDurationQuery,
MaxDurationObservation: *pubCfg.MaxDurationObservation,
MaxDurationShouldAcceptAttestedReport: *pubCfg.MaxDurationShouldAcceptAttestedReport,
MaxDurationShouldTransmitAcceptedReport: *pubCfg.MaxDurationShouldTransmitAcceptedReport,
F: *pubCfg.F,
}
}

func BuildAutoOCR2ConfigVarsLocal(
l zerolog.Logger,
chainlinkNodes []*client.ChainlinkClient,
Expand Down
22 changes: 4 additions & 18 deletions integration-tests/benchmark/automation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
sethutils "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/seth"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
ethcontracts "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum"
tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig"
"github.com/smartcontractkit/chainlink/integration-tests/testsetups"
Expand Down Expand Up @@ -94,25 +93,12 @@ func TestAutomationBenchmark(t *testing.T) {
require.NoError(t, err, "Error getting Seth client")

registryVersions := addRegistry(&config)
registrySettings := actions.ReadRegistryConfig(config)
keeperBenchmarkTest := testsetups.NewKeeperBenchmarkTest(t,
testsetups.KeeperBenchmarkTestInputs{
BlockchainClient: chainClient,
RegistryVersions: registryVersions,
KeeperRegistrySettings: &contracts.KeeperRegistrySettings{
PaymentPremiumPPB: uint32(0),
FlatFeeMicroLINK: uint32(40000),
BlockCountPerTurn: big.NewInt(100),
CheckGasLimit: uint32(45_000_000), //45M
StalenessSeconds: big.NewInt(90_000),
GasCeilingMultiplier: uint16(2),
MaxPerformGas: uint32(*config.Automation.Benchmark.MaxPerformGas),
MinUpkeepSpend: big.NewInt(0),
FallbackGasPrice: big.NewInt(2e11),
FallbackLinkPrice: big.NewInt(2e18),
MaxCheckDataSize: uint32(5_000),
MaxPerformDataSize: uint32(5_000),
MaxRevertDataSize: uint32(5_000),
},
BlockchainClient: chainClient,
RegistryVersions: registryVersions,
KeeperRegistrySettings: &registrySettings,
Upkeeps: &testsetups.UpkeepConfig{
NumberOfUpkeeps: *config.Automation.Benchmark.NumberOfUpkeeps,
CheckGasToBurn: *config.Automation.Benchmark.CheckGasToBurn,
Expand Down
49 changes: 4 additions & 45 deletions integration-tests/chaos/automation_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (
"testing"
"time"

ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"

ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config"
"github.com/smartcontractkit/chainlink/integration-tests/actions/automationv2"

seth_utils "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/seth"
Expand Down Expand Up @@ -245,53 +242,15 @@ func TestAutomationChaos(t *testing.T) {

a := automationv2.NewAutomationTestK8s(l, chainClient, chainlinkNodes)
a.SetMercuryCredentialName("cred1")
conf := config.Automation.AutomationConfig
a.RegistrySettings = contracts.KeeperRegistrySettings{
PaymentPremiumPPB: *conf.RegistrySettings.PaymentPremiumPPB,
FlatFeeMicroLINK: *conf.RegistrySettings.FlatFeeMicroLINK,
CheckGasLimit: *conf.RegistrySettings.CheckGasLimit,
StalenessSeconds: conf.RegistrySettings.StalenessSeconds,
GasCeilingMultiplier: *conf.RegistrySettings.GasCeilingMultiplier,
MaxPerformGas: *conf.RegistrySettings.MaxPerformGas,
MinUpkeepSpend: conf.RegistrySettings.MinUpkeepSpend,
FallbackGasPrice: conf.RegistrySettings.FallbackGasPrice,
FallbackLinkPrice: conf.RegistrySettings.FallbackLinkPrice,
MaxCheckDataSize: *conf.RegistrySettings.MaxCheckDataSize,
MaxPerformDataSize: *conf.RegistrySettings.MaxPerformDataSize,
MaxRevertDataSize: *conf.RegistrySettings.MaxRevertDataSize,
RegistryVersion: rv,
}
a.RegistrySettings = actions.ReadRegistryConfig(config)
a.RegistrySettings.RegistryVersion = rv
a.PluginConfig = actions.ReadPluginConfig(config)
a.PublicConfig = actions.ReadPublicConfig(config)
a.RegistrarSettings = contracts.KeeperRegistrarSettings{
AutoApproveConfigType: uint8(2),
AutoApproveMaxAllowed: 1000,
MinLinkJuels: big.NewInt(0),
}
plCfg := config.GetAutomationConfig().AutomationConfig.PluginConfig
a.PluginConfig = ocr2keepers30config.OffchainConfig{
TargetProbability: *plCfg.TargetProbability,
TargetInRounds: *plCfg.TargetInRounds,
PerformLockoutWindow: *plCfg.PerformLockoutWindow,
GasLimitPerReport: *plCfg.GasLimitPerReport,
GasOverheadPerUpkeep: *plCfg.GasOverheadPerUpkeep,
MinConfirmations: *plCfg.MinConfirmations,
MaxUpkeepBatchSize: *plCfg.MaxUpkeepBatchSize,
}
pubCfg := config.GetAutomationConfig().AutomationConfig.PublicConfig
a.PublicConfig = ocr3.PublicConfig{
DeltaProgress: *pubCfg.DeltaProgress,
DeltaResend: *pubCfg.DeltaResend,
DeltaInitial: *pubCfg.DeltaInitial,
DeltaRound: *pubCfg.DeltaRound,
DeltaGrace: *pubCfg.DeltaGrace,
DeltaCertifiedCommitRequest: *pubCfg.DeltaCertifiedCommitRequest,
DeltaStage: *pubCfg.DeltaStage,
RMax: *pubCfg.RMax,
MaxDurationQuery: *pubCfg.MaxDurationQuery,
MaxDurationObservation: *pubCfg.MaxDurationObservation,
MaxDurationShouldAcceptAttestedReport: *pubCfg.MaxDurationShouldAcceptAttestedReport,
MaxDurationShouldTransmitAcceptedReport: *pubCfg.MaxDurationShouldTransmitAcceptedReport,
F: *pubCfg.F,
}

a.SetupAutomationDeployment(t)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/contracts/ethereum_keeper_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (rcs *KeeperRegistrySettings) Create23OnchainConfig(registrar string, regis
ChainModule: chainModuleAddress,
ReorgProtectionEnabled: reorgProtectionEnabled,
FinanceAdmin: registryOwnerAddress,
FallbackNativePrice: rcs.FallbackLinkPrice, // Just use the LINK price
FallbackNativePrice: rcs.FallbackNativePrice,
}
}

Expand Down
55 changes: 6 additions & 49 deletions integration-tests/load/automationv2_1/automationv2_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ import (
"github.com/slack-go/slack"
"github.com/stretchr/testify/require"

ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"

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

ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config"

"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/environment"
"github.com/smartcontractkit/chainlink-testing-framework/lib/k8s/pkg/helm/chainlink"
Expand Down Expand Up @@ -154,6 +150,7 @@ func setUpDataStreamsWireMock(url string) error {
func TestLogTrigger(t *testing.T) {
ctx := tests.Context(t)
l := logging.GetTestLogger(t)
registryVersion := contractseth.RegistryVersion_2_1

loadedTestConfig, err := tc.GetConfig([]string{"Load"}, tc.Automation)
if err != nil {
Expand Down Expand Up @@ -315,55 +312,15 @@ Load Config:
require.NoError(t, err, "Error deploying multicall contract")

a := automationv2.NewAutomationTestK8s(l, chainClient, chainlinkNodes)
conf := loadedTestConfig.Automation.AutomationConfig
a.RegistrySettings = contracts.KeeperRegistrySettings{
PaymentPremiumPPB: *conf.RegistrySettings.PaymentPremiumPPB,
FlatFeeMicroLINK: *conf.RegistrySettings.FlatFeeMicroLINK,
CheckGasLimit: *conf.RegistrySettings.CheckGasLimit,
StalenessSeconds: conf.RegistrySettings.StalenessSeconds,
GasCeilingMultiplier: *conf.RegistrySettings.GasCeilingMultiplier,
MaxPerformGas: *conf.RegistrySettings.MaxPerformGas,
MinUpkeepSpend: conf.RegistrySettings.MinUpkeepSpend,
FallbackGasPrice: conf.RegistrySettings.FallbackGasPrice,
FallbackLinkPrice: conf.RegistrySettings.FallbackLinkPrice,
MaxCheckDataSize: *conf.RegistrySettings.MaxCheckDataSize,
MaxPerformDataSize: *conf.RegistrySettings.MaxPerformDataSize,
MaxRevertDataSize: *conf.RegistrySettings.MaxRevertDataSize,
RegistryVersion: contractseth.RegistryVersion_2_1,
}
a.RegistrySettings = actions.ReadRegistryConfig(loadedTestConfig)
a.RegistrySettings.RegistryVersion = registryVersion
a.PluginConfig = actions.ReadPluginConfig(loadedTestConfig)
a.PublicConfig = actions.ReadPublicConfig(loadedTestConfig)
a.RegistrarSettings = contracts.KeeperRegistrarSettings{
AutoApproveConfigType: uint8(2),
AutoApproveMaxAllowed: math.MaxUint16,
AutoApproveMaxAllowed: 1000,
MinLinkJuels: big.NewInt(0),
}
a.PluginConfig = ocr2keepers30config.OffchainConfig{
TargetProbability: *conf.PluginConfig.TargetProbability,
TargetInRounds: *conf.PluginConfig.TargetInRounds,
PerformLockoutWindow: *conf.PluginConfig.PerformLockoutWindow,
GasLimitPerReport: *conf.PluginConfig.GasLimitPerReport,
GasOverheadPerUpkeep: *conf.PluginConfig.GasOverheadPerUpkeep,
MinConfirmations: *conf.PluginConfig.MinConfirmations,
MaxUpkeepBatchSize: *conf.PluginConfig.MaxUpkeepBatchSize,
LogProviderConfig: ocr2keepers30config.LogProviderConfig{
BlockRate: *conf.PluginConfig.LogProviderConfig.BlockRate,
LogLimit: *conf.PluginConfig.LogProviderConfig.LogLimit,
},
}
a.PublicConfig = ocr3.PublicConfig{
DeltaProgress: *conf.PublicConfig.DeltaProgress,
DeltaResend: *conf.PublicConfig.DeltaResend,
DeltaInitial: *conf.PublicConfig.DeltaInitial,
DeltaRound: *conf.PublicConfig.DeltaRound,
DeltaGrace: *conf.PublicConfig.DeltaGrace,
DeltaCertifiedCommitRequest: *conf.PublicConfig.DeltaCertifiedCommitRequest,
DeltaStage: *conf.PublicConfig.DeltaStage,
RMax: *conf.PublicConfig.RMax,
MaxDurationQuery: *conf.PublicConfig.MaxDurationQuery,
MaxDurationObservation: *conf.PublicConfig.MaxDurationObservation,
MaxDurationShouldAcceptAttestedReport: *conf.PublicConfig.MaxDurationShouldAcceptAttestedReport,
MaxDurationShouldTransmitAcceptedReport: *conf.PublicConfig.MaxDurationShouldTransmitAcceptedReport,
F: *conf.PublicConfig.F,
}

if *loadedTestConfig.Automation.DataStreams.Enabled {
a.SetMercuryCredentialName("cred1")
Expand Down
36 changes: 4 additions & 32 deletions integration-tests/reorg/automation_reorg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
"strings"
"testing"

ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"
"go.uber.org/zap/zapcore"

ocr2keepers30config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config"
"github.com/smartcontractkit/chainlink-testing-framework/lib/testreporters"
sethUtils "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/seth"
"github.com/smartcontractkit/chainlink/integration-tests/actions/automationv2"
Expand Down Expand Up @@ -134,43 +132,17 @@ func TestAutomationReorg(t *testing.T) {

gethRPCClient := ctfClient.NewRPCClient(evmNetwork.HTTPURLs[0], nil)

registryConfig := actions.AutomationDefaultRegistryConfig(config)
registryConfig.RegistryVersion = registryVersion

a := automationv2.NewAutomationTestDocker(l, sethClient, nodeClients)
a.SetMercuryCredentialName("cred1")
a.RegistrySettings = registryConfig
a.RegistrySettings = actions.ReadRegistryConfig(config)
a.RegistrySettings.RegistryVersion = registryVersion
a.PluginConfig = actions.ReadPluginConfig(config)
a.PublicConfig = actions.ReadPublicConfig(config)
a.RegistrarSettings = contracts.KeeperRegistrarSettings{
AutoApproveConfigType: uint8(2),
AutoApproveMaxAllowed: 1000,
MinLinkJuels: big.NewInt(0),
}
plCfg := config.GetAutomationConfig().AutomationConfig.PluginConfig
a.PluginConfig = ocr2keepers30config.OffchainConfig{
TargetProbability: *plCfg.TargetProbability,
TargetInRounds: *plCfg.TargetInRounds,
PerformLockoutWindow: *plCfg.PerformLockoutWindow,
GasLimitPerReport: *plCfg.GasLimitPerReport,
GasOverheadPerUpkeep: *plCfg.GasOverheadPerUpkeep,
MinConfirmations: *plCfg.MinConfirmations,
MaxUpkeepBatchSize: *plCfg.MaxUpkeepBatchSize,
}
pubCfg := config.GetAutomationConfig().AutomationConfig.PublicConfig
a.PublicConfig = ocr3.PublicConfig{
DeltaProgress: *pubCfg.DeltaProgress,
DeltaResend: *pubCfg.DeltaResend,
DeltaInitial: *pubCfg.DeltaInitial,
DeltaRound: *pubCfg.DeltaRound,
DeltaGrace: *pubCfg.DeltaGrace,
DeltaCertifiedCommitRequest: *pubCfg.DeltaCertifiedCommitRequest,
DeltaStage: *pubCfg.DeltaStage,
RMax: *pubCfg.RMax,
MaxDurationQuery: *pubCfg.MaxDurationQuery,
MaxDurationObservation: *pubCfg.MaxDurationObservation,
MaxDurationShouldAcceptAttestedReport: *pubCfg.MaxDurationShouldAcceptAttestedReport,
MaxDurationShouldTransmitAcceptedReport: *pubCfg.MaxDurationShouldTransmitAcceptedReport,
F: *pubCfg.F,
}

a.SetupAutomationDeployment(t)
a.SetDockerEnv(env)
Expand Down
Loading

0 comments on commit e8bfa58

Please sign in to comment.