Skip to content

Commit

Permalink
update to use ocr2keepers v3 (#10169)
Browse files Browse the repository at this point in the history
  • Loading branch information
shileiwill authored Aug 11, 2023
1 parent c09c7c7 commit 9efa475
Showing 1 changed file with 84 additions and 34 deletions.
118 changes: 84 additions & 34 deletions integration-tests/actions/automation_ocr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/lib/pq"
ocr3 "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"
"github.com/stretchr/testify/require"
"gopkg.in/guregu/null.v4"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/utils"
"github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper"
ocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper"
ocr2keepers20config "github.com/smartcontractkit/ocr2keepers/pkg/v2/config"
ocr2keepers30config "github.com/smartcontractkit/ocr2keepers/pkg/v3/config"

"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
"github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum"

"github.com/smartcontractkit/libocr/offchainreporting2plus/types"

"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
Expand Down Expand Up @@ -52,40 +56,86 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex(
return contracts.OCRv2Config{}, err
}

offC, err := json.Marshal(ocr2keepers20config.OffchainConfig{
TargetProbability: "0.999",
TargetInRounds: 1,
PerformLockoutWindow: 3600000, // Intentionally set to be higher than in prod for testing purpose
GasLimitPerReport: 5_300_000,
GasOverheadPerUpkeep: 300_000,
SamplingJobDuration: 3000,
MinConfirmations: 0,
MaxUpkeepBatchSize: 1,
})
if err != nil {
return contracts.OCRv2Config{}, err
}
var offC []byte
var signerOnchainPublicKeys []types.OnchainPublicKey
var transmitterAccounts []types.Account
var f uint8
var offchainConfigVersion uint64
var offchainConfig []byte

signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err := confighelper.ContractSetConfigArgsForTests(
10*time.Second, // deltaProgress time.Duration,
15*time.Second, // deltaResend time.Duration,
3000*time.Millisecond, // deltaRound time.Duration,
200*time.Millisecond, // deltaGrace time.Duration,
deltaStage, // deltaStage time.Duration,
24, // rMax uint8,
S, // s []int,
oracleIdentities, // oracles []OracleIdentityExtra,
offC, // reportingPluginConfig []byte,
20*time.Millisecond, // maxDurationQuery time.Duration,
20*time.Millisecond, // maxDurationObservation time.Duration,
1200*time.Millisecond, // maxDurationReport time.Duration,
20*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration,
20*time.Millisecond, // maxDurationShouldTransmitAcceptedReport time.Duration,
1, // f int,
nil, // onchainConfig []byte,
)
if err != nil {
return contracts.OCRv2Config{}, err
if registryConfig.RegistryVersion == ethereum.RegistryVersion_2_1 {
offC, err = json.Marshal(ocr2keepers30config.OffchainConfig{
TargetProbability: "0.999",
TargetInRounds: 1,
PerformLockoutWindow: 3600000, // Intentionally set to be higher than in prod for testing purpose
GasLimitPerReport: 5_300_000,
GasOverheadPerUpkeep: 300_000,
SamplingJobDuration: 3000,
MinConfirmations: 0,
MaxUpkeepBatchSize: 1,
})
if err != nil {
return contracts.OCRv2Config{}, err
}

signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = ocr3.ContractSetConfigArgsForTests(
10*time.Second, // deltaProgress time.Duration,
15*time.Second, // deltaResend time.Duration,
500*time.Millisecond, // deltaInitial time.Duration,
3000*time.Millisecond, // deltaRound time.Duration,
200*time.Millisecond, // deltaGrace time.Duration,
300*time.Millisecond, // deltaCertifiedCommitRequest time.Duration
deltaStage, // deltaStage time.Duration,
24, // rMax uint64,
S, // s []int,
oracleIdentities, // oracles []OracleIdentityExtra,
offC, // reportingPluginConfig []byte,
20*time.Millisecond, // maxDurationQuery time.Duration,
20*time.Millisecond, // maxDurationObservation time.Duration, // good to here
1200*time.Millisecond, // maxDurationShouldAcceptAttestedReport time.Duration,
20*time.Millisecond, // maxDurationShouldTransmitAcceptedReport time.Duration,
1, // f int,
nil, // onchainConfig []byte,
)
if err != nil {
return contracts.OCRv2Config{}, err
}
} else {
offC, err = json.Marshal(ocr2keepers20config.OffchainConfig{
TargetProbability: "0.999",
TargetInRounds: 1,
PerformLockoutWindow: 3600000, // Intentionally set to be higher than in prod for testing purpose
GasLimitPerReport: 5_300_000,
GasOverheadPerUpkeep: 300_000,
SamplingJobDuration: 3000,
MinConfirmations: 0,
MaxUpkeepBatchSize: 1,
})
if err != nil {
return contracts.OCRv2Config{}, err
}

signerOnchainPublicKeys, transmitterAccounts, f, _, offchainConfigVersion, offchainConfig, err = ocr2.ContractSetConfigArgsForTests(
10*time.Second, // deltaProgress time.Duration,
15*time.Second, // deltaResend time.Duration,
3000*time.Millisecond, // deltaRound time.Duration,
200*time.Millisecond, // deltaGrace time.Duration,
deltaStage, // deltaStage time.Duration,
24, // rMax uint8,
S, // s []int,
oracleIdentities, // oracles []OracleIdentityExtra,
offC, // reportingPluginConfig []byte,
20*time.Millisecond, // maxDurationQuery time.Duration,
20*time.Millisecond, // maxDurationObservation time.Duration,
1200*time.Millisecond, // maxDurationReport time.Duration,
20*time.Millisecond, // maxDurationShouldAcceptFinalizedReport time.Duration,
20*time.Millisecond, // maxDurationShouldTransmitAcceptedReport time.Duration,
1, // f int,
nil, // onchainConfig []byte,
)
if err != nil {
return contracts.OCRv2Config{}, err
}
}

var signers []common.Address
Expand Down

0 comments on commit 9efa475

Please sign in to comment.