Skip to content

Commit

Permalink
fix linter issues and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFan1992 committed Feb 19, 2024
1 parent c002f12 commit cd2f54c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion integration-tests/actions/automation_ocr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func CreateOCRKeeperJobs(
bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID

var contractVersion string
// TODO: use v2.1 for registry 2.2 for now until
// TODO: use v2.1 for registry 2.2 for now until AUTO-9033 is done
if registryVersion == ethereum.RegistryVersion_2_1 || registryVersion == ethereum.RegistryVersion_2_2 {
contractVersion = "v2.1"
} else if registryVersion == ethereum.RegistryVersion_2_0 {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/actions/automation_ocr_helpers_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func CreateOCRKeeperJobsLocal(
bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID

var contractVersion string
// TODO: use v2.1 for registry 2.2 for now until
// TODO: use v2.1 for registry 2.2 for now until AUTO-9033 is done
if registryVersion == ethereum.RegistryVersion_2_1 || registryVersion == ethereum.RegistryVersion_2_2 {
contractVersion = "v2.1"
} else if registryVersion == ethereum.RegistryVersion_2_0 {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/actions/automationv2/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ func (a *AutomationTest) AddBootstrapJob() error {

func (a *AutomationTest) AddAutomationJobs() error {
var contractVersion string
// TODO: use v2.1 for registry 2.2 for now until AUTO-9033 is done
if a.RegistrySettings.RegistryVersion == ethereum.RegistryVersion_2_1 || a.RegistrySettings.RegistryVersion == ethereum.RegistryVersion_2_2 {
contractVersion = "v2.1"
} else if a.RegistrySettings.RegistryVersion == ethereum.RegistryVersion_2_0 {
Expand Down
36 changes: 20 additions & 16 deletions integration-tests/contracts/ethereum_keeper_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,27 +712,31 @@ func (v *EthereumKeeperRegistry) GetUpkeepInfo(ctx context.Context, id *big.Int)
OffchainConfig: uk.OffchainConfig,
}, nil
case ethereum.RegistryVersion_2_2:
uk, err := v.registry2_2.GetUpkeep(opts, id)
if err != nil {
return nil, err
}
return &UpkeepInfo{
Target: uk.Target.Hex(),
ExecuteGas: uk.PerformGas,
CheckData: uk.CheckData,
Balance: uk.Balance,
Admin: uk.Admin.Hex(),
MaxValidBlocknumber: uk.MaxValidBlocknumber,
LastPerformBlockNumber: uk.LastPerformedBlockNumber,
AmountSpent: uk.AmountSpent,
Paused: uk.Paused,
OffchainConfig: uk.OffchainConfig,
}, nil
return v.getUpkeepInfo22(opts, id)
}

return nil, fmt.Errorf("keeper registry version %d is not supported", v.version)
}

func (v *EthereumKeeperRegistry) getUpkeepInfo22(opts *bind.CallOpts, id *big.Int) (*UpkeepInfo, error) {
uk, err := v.registry2_2.GetUpkeep(opts, id)
if err != nil {
return nil, err
}
return &UpkeepInfo{
Target: uk.Target.Hex(),
ExecuteGas: uk.PerformGas,
CheckData: uk.CheckData,
Balance: uk.Balance,
Admin: uk.Admin.Hex(),
MaxValidBlocknumber: uk.MaxValidBlocknumber,
LastPerformBlockNumber: uk.LastPerformedBlockNumber,
AmountSpent: uk.AmountSpent,
Paused: uk.Paused,
OffchainConfig: uk.OffchainConfig,
}, nil
}

func (v *EthereumKeeperRegistry) GetKeeperInfo(ctx context.Context, keeperAddr string) (*KeeperInfo, error) {
opts := &bind.CallOpts{
From: common.HexToAddress(v.client.GetDefaultWallet().Address()),
Expand Down

0 comments on commit cd2f54c

Please sign in to comment.