Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRF-881: fixed toml config for VRF Load tests; VRF-882: add more cust… #11991

Merged
merged 28 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e316af
VRF-881: fixed toml config for VRF Load tests; VRF-882: add more cust…
iljapavlovs Feb 11, 2024
0e3ef15
VRF-881: fixing lint
iljapavlovs Feb 11, 2024
00dee3f
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 12, 2024
9842d96
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 14, 2024
b275212
VRF-881: upgrading ctf library
iljapavlovs Feb 14, 2024
72c46f5
VRF-881: adding load test metric calculation in seconds for VRF V2Plu…
iljapavlovs Feb 15, 2024
2ad88c2
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 15, 2024
6a8a917
VRF-881: sync with develop
iljapavlovs Feb 15, 2024
31eba76
VRF-881: sync with develop
iljapavlovs Feb 16, 2024
d2ccd41
VRF-881: sync with develop
iljapavlovs Feb 20, 2024
9609c3b
VRF-881: PR comments;
iljapavlovs Feb 21, 2024
3839179
VRF-881: fixing Lint issues
iljapavlovs Feb 21, 2024
17751ef
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 21, 2024
79cd6b0
VRF-881: fixing BHS tests
iljapavlovs Feb 21, 2024
62c88d9
VRF-881: adding smoke test type
iljapavlovs Feb 21, 2024
a756318
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 22, 2024
a73b63d
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 23, 2024
5bf2f63
VRF-881: PR comments
iljapavlovs Feb 23, 2024
54a36e8
VRF-881: fixing load test
iljapavlovs Feb 23, 2024
e5b26b2
VRF-881: fixing config
iljapavlovs Feb 23, 2024
43ffb33
VRF-881: fixing e2e tests
iljapavlovs Feb 23, 2024
542c642
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 23, 2024
8ba7497
VRF-881: fixing sonar
iljapavlovs Feb 23, 2024
214acd0
Merge remote-tracking branch 'origin/chore/vrf-881-vrf-882' into chor…
iljapavlovs Feb 23, 2024
1fe0b96
VRF-881: fixing sonar and refactoring
iljapavlovs Feb 24, 2024
58b8b18
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 24, 2024
d03afbb
VRF-881: fixing lint issues
iljapavlovs Feb 24, 2024
7b7a3cf
Merge branch 'develop' into chore/vrf-881-vrf-882
iljapavlovs Feb 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions core/scripts/common/vrf/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ coordinatorV2Address = "%s"
waitBlocks = %d
lookbackBlocks = %d
blockhashStoreAddress = "%s"
pollPeriod = "30s"
runTimeout = "1m0s"
pollPeriod = "%s"
runTimeout = "%s"
evmChainID = "%d"
fromAddresses = ["%s"]
`
BHSPlusJobFormatted = `type = "blockhashstore"
schemaVersion = 1
name = "blockhashstore"
forwardingAllowed = false
coordinatorV2Address = "%s"
coordinatorV2PlusAddress = "%s"
waitBlocks = %d
lookbackBlocks = %d
blockhashStoreAddress = "%s"
pollPeriod = "30s"
runTimeout = "1m0s"
pollPeriod = "%s"
runTimeout = "%s"
evmChainID = "%d"
fromAddresses = ["%s"]
`
Expand Down
8 changes: 8 additions & 0 deletions core/scripts/common/vrf/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ type CoordinatorJobSpecConfig struct {
RequestTimeout string
RevertsPipelineEnabled bool
}

type BHSJobSpecConfig struct {
RunTimeout string
WaitBlocks int
LookBackBlocks int
PollPeriod string
RequestTimeout string
}
10 changes: 9 additions & 1 deletion core/scripts/common/vrf/setup-envs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ go run . \
--request-timeout="30m0s" \
--reverts-pipeline-enabled="true" \
--min-confs=3 \
--bhs-job-wait-blocks=30 \
--bhs-job-look-back-blocks=200 \
--bhs-job-poll-period="1s" \
--bhs-job-run-timeout="1m" \
--register-vrf-key-against-address=<vrf key will be registered against this address
in order to call oracleWithdraw from this address> \
--deploy-vrfv2-owner="true" \
Expand Down Expand Up @@ -79,7 +83,11 @@ go run . \
--estimate-gas-multiplier=1.1 \
--poll-period="5s" \
--request-timeout="30m0s" \
--min-confs=3
--min-confs=3 \
--bhs-job-wait-blocks=30 \
--bhs-job-look-back-blocks=200 \
--bhs-job-poll-period="1s" \
--bhs-job-run-timeout="1m"
```

Optional parameters - will not be deployed if specified
Expand Down
21 changes: 20 additions & 1 deletion core/scripts/common/vrf/setup-envs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ func main() {
bhfCredsFile := flag.String("bhf-creds-file", "", "Creds to authenticate to the node")

numEthKeys := flag.Int("num-eth-keys", 5, "Number of eth keys to create")
maxGasPriceGwei := flag.Int("max-gas-price-gwei", 1e12, "Max gas price gwei of the eth keys")
maxGasPriceGwei := flag.Int("max-gas-price-gwei", -1, "Max gas price gwei of the eth keys")
iljapavlovs marked this conversation as resolved.
Show resolved Hide resolved
numVRFKeys := flag.Int("num-vrf-keys", 1, "Number of vrf keys to create")
batchFulfillmentEnabled := flag.Bool("batch-fulfillment-enabled", constants.BatchFulfillmentEnabled, "whether send randomness fulfillments in batches inside one tx from CL node")
batchFulfillmentGasMultiplier := flag.Float64("batch-fulfillment-gas-multiplier", 1.1, "")
estimateGasMultiplier := flag.Float64("estimate-gas-multiplier", 1.1, "")
pollPeriod := flag.String("poll-period", "300ms", "")
requestTimeout := flag.String("request-timeout", "30m0s", "")
revertsPipelineEnabled := flag.Bool("reverts-pipeline-enabled", true, "")
bhsJobWaitBlocks := flag.Int("bhs-job-wait-blocks", 30, "")
bhsJobLookBackBlocks := flag.Int("bhs-job-look-back-blocks", 200, "")
bhsJobPollPeriod := flag.String("bhs-job-poll-period", "3s", "")
bhsJobRunTimeout := flag.String("bhs-job-run-timeout", "1m", "")
iljapavlovs marked this conversation as resolved.
Show resolved Hide resolved

vrfVersion := flag.String("vrf-version", "v2", "VRF version to use")
deployContractsAndCreateJobs := flag.Bool("deploy-contracts-and-create-jobs", false, "whether to deploy contracts and create jobs")
Expand Down Expand Up @@ -218,6 +222,12 @@ func main() {
RevertsPipelineEnabled: *revertsPipelineEnabled,
}

bhsJobSpecConfig := model.BHSJobSpecConfig{
RunTimeout: *bhsJobRunTimeout,
WaitBlocks: *bhsJobWaitBlocks,
LookBackBlocks: *bhsJobLookBackBlocks,
PollPeriod: *bhsJobPollPeriod,
}
jobSpecs = v2scripts.VRFV2DeployUniverse(
e,
subscriptionBalanceJuels,
Expand All @@ -227,6 +237,7 @@ func main() {
nodesMap,
*deployVRFOwner,
coordinatorJobSpecConfig,
bhsJobSpecConfig,
*useTestCoordinator,
)
case "v2plus":
Expand All @@ -250,6 +261,13 @@ func main() {
RequestTimeout: *requestTimeout,
}

bhsJobSpecConfig := model.BHSJobSpecConfig{
RunTimeout: *bhsJobRunTimeout,
WaitBlocks: *bhsJobWaitBlocks,
LookBackBlocks: *bhsJobLookBackBlocks,
PollPeriod: *bhsJobPollPeriod,
}

jobSpecs = v2plusscripts.VRFV2PlusDeployUniverse(
e,
subscriptionBalanceJuels,
Expand All @@ -260,6 +278,7 @@ func main() {
nodesMap,
uint64(*maxGasPriceGwei),
coordinatorJobSpecConfig,
bhsJobSpecConfig,
)
}

Expand Down
21 changes: 18 additions & 3 deletions core/scripts/vrfv2/testnet/v2scripts/super_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func DeployUniverseViaCLI(e helpers.Environment) {
pollPeriod := deployCmd.String("poll-period", "300ms", "")
requestTimeout := deployCmd.String("request-timeout", "30m0s", "")
revertsPipelineEnabled := deployCmd.Bool("reverts-pipeline-enabled", true, "")
bhsJobWaitBlocks := flag.Int("bhs-job-wait-blocks", 30, "")
bhsJobLookBackBlocks := flag.Int("bhs-job-look-back-blocks", 200, "")
bhsJobPollPeriod := flag.String("bhs-job-poll-period", "3s", "")
bhsJobRunTimeout := flag.String("bhs-job-run-timeout", "1m", "")

deployVRFOwner := deployCmd.Bool("deploy-vrf-owner", true, "whether to deploy VRF owner contracts")
useTestCoordinator := deployCmd.Bool("use-test-coordinator", true, "whether to use test coordinator")
Expand Down Expand Up @@ -152,6 +156,13 @@ func DeployUniverseViaCLI(e helpers.Environment) {
RevertsPipelineEnabled: *revertsPipelineEnabled,
}

bhsJobSpecConfig := model.BHSJobSpecConfig{
RunTimeout: *bhsJobRunTimeout,
WaitBlocks: *bhsJobWaitBlocks,
LookBackBlocks: *bhsJobLookBackBlocks,
PollPeriod: *bhsJobPollPeriod,
}

VRFV2DeployUniverse(
e,
subscriptionBalanceJuels,
Expand All @@ -161,6 +172,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {
nodesMap,
*deployVRFOwner,
coordinatorJobSpecConfig,
bhsJobSpecConfig,
*useTestCoordinator,
)

Expand All @@ -180,6 +192,7 @@ func VRFV2DeployUniverse(
nodesMap map[string]model.Node,
deployVRFOwner bool,
coordinatorJobSpecConfig model.CoordinatorJobSpecConfig,
bhsJobSpecConfig model.BHSJobSpecConfig,
useTestCoordinator bool,
) model.JobSpecs {
var compressedPkHex string
Expand Down Expand Up @@ -397,10 +410,12 @@ func VRFV2DeployUniverse(
formattedBHSJobSpec := fmt.Sprintf(
jobs.BHSJobFormatted,
contractAddresses.CoordinatorAddress, //coordinatorAddress
30, //waitBlocks
200, //lookbackBlocks
bhsJobSpecConfig.WaitBlocks, //waitBlocks
bhsJobSpecConfig.LookBackBlocks, //lookbackBlocks
contractAddresses.BhsContractAddress, //bhs address
e.ChainID, //chain id
bhsJobSpecConfig.PollPeriod,
bhsJobSpecConfig.RunTimeout,
e.ChainID, //chain id
strings.Join(util.MapToAddressArr(nodesMap[model.BHSNodeName].SendingKeys), "\",\""), //sending addresses
)

Expand Down
2 changes: 1 addition & 1 deletion core/scripts/vrfv2plus/testnet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ func main() {
cbGasLimit := request.Uint("cb-gas-limit", 100_000, "request callback gas limit")
nativePaymentEnabled := request.Bool("native-payment-enabled", false, "native payment enabled")
numWords := request.Uint("num-words", 1, "num words to request")
requests := request.Uint("requests", 10, "number of randomness requests to make per run")
requests := request.Uint("requests", 1, "number of randomness requests to make per run")
runs := request.Uint("runs", 1, "number of runs to do. total randomness requests will be (requests * runs).")
helpers.ParseArgs(request, os.Args[2:], "consumer-address", "sub-id", "key-hash")
keyHashBytes := common.HexToHash(*keyHash)
Expand Down
25 changes: 22 additions & 3 deletions core/scripts/vrfv2plus/testnet/v2plusscripts/super_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ func DeployUniverseViaCLI(e helpers.Environment) {
estimateGasMultiplier := deployCmd.Float64("estimate-gas-multiplier", 1.1, "")
pollPeriod := deployCmd.String("poll-period", "300ms", "")
requestTimeout := deployCmd.String("request-timeout", "30m0s", "")
bhsJobWaitBlocks := flag.Int("bhs-job-wait-blocks", 30, "")
bhsJobLookBackBlocks := flag.Int("bhs-job-look-back-blocks", 200, "")
bhsJobPollPeriod := flag.String("bhs-job-poll-period", "3s", "")
bhsJobRunTimeout := flag.String("bhs-job-run-timeout", "1m", "")

// optional flags
fallbackWeiPerUnitLinkString := deployCmd.String("fallback-wei-per-unit-link", "6e16", "fallback wei/link ratio")
Expand Down Expand Up @@ -562,6 +566,13 @@ func DeployUniverseViaCLI(e helpers.Environment) {
RequestTimeout: *requestTimeout,
}

bhsJobSpecConfig := model.BHSJobSpecConfig{
RunTimeout: *bhsJobRunTimeout,
WaitBlocks: *bhsJobWaitBlocks,
LookBackBlocks: *bhsJobLookBackBlocks,
PollPeriod: *bhsJobPollPeriod,
}

VRFV2PlusDeployUniverse(
e,
subscriptionBalanceJuels,
Expand All @@ -572,6 +583,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {
nodesMap,
uint64(*gasLaneMaxGas),
coordinatorJobSpecConfig,
bhsJobSpecConfig,
)

vrfPrimaryNode := nodesMap[model.VRFPrimaryNodeName]
Expand All @@ -590,6 +602,7 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
nodesMap map[string]model.Node,
gasLaneMaxGas uint64,
coordinatorJobSpecConfig model.CoordinatorJobSpecConfig,
bhsJobSpecConfig model.BHSJobSpecConfig,
) model.JobSpecs {
var compressedPkHex string
var keyHash common.Hash
Expand Down Expand Up @@ -764,19 +777,25 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
formattedBHSJobSpec := fmt.Sprintf(
jobs.BHSPlusJobFormatted,
contractAddresses.CoordinatorAddress, //coordinatorAddress
30, //waitBlocks
200, //lookbackBlocks
contractAddresses.CoordinatorAddress, //coordinatorAddress
bhsJobSpecConfig.WaitBlocks, //waitBlocks
bhsJobSpecConfig.LookBackBlocks, //lookbackBlocks
contractAddresses.BhsContractAddress, //bhs address
bhsJobSpecConfig.PollPeriod, //pollPeriod
bhsJobSpecConfig.RunTimeout, //runTimeout
e.ChainID, //chain id
strings.Join(util.MapToAddressArr(nodesMap[model.BHSNodeName].SendingKeys), "\",\""), //sending addresses
)

formattedBHSBackupJobSpec := fmt.Sprintf(
jobs.BHSPlusJobFormatted,
contractAddresses.CoordinatorAddress, //coordinatorAddress
contractAddresses.CoordinatorAddress, //coordinatorAddress
100, //waitBlocks
200, //lookbackBlocks
contractAddresses.BhsContractAddress, //bhs adreess
bhsJobSpecConfig.PollPeriod, //pollPeriod
bhsJobSpecConfig.RunTimeout, //runTimeout
e.ChainID, //chain id
strings.Join(util.MapToAddressArr(nodesMap[model.BHSBackupNodeName].SendingKeys), "\",\""), //sending addresses
)
Expand All @@ -803,7 +822,7 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
"\nVRF Subscription LINK Balance:", *subscriptionBalanceJuels,
"\nVRF Subscription Native Balance:", *subscriptionBalanceNativeWei,
"\nPossible VRF Request command: ",
fmt.Sprintf("go run . eoa-load-test-request-with-metrics --consumer-address=%s --sub-id=%d --key-hash=%s --request-confirmations %d --requests 1 --runs 1 --cb-gas-limit 1_000_000", consumerAddress, subID, keyHash, coordinatorConfig.MinConfs),
fmt.Sprintf("go run . eoa-load-test-request-with-metrics --consumer-address=%s --sub-id=%d --key-hash=%s --request-confirmations %d --native-payment-enabled true --requests 1 --runs 1 --cb-gas-limit 1_000_000", consumerAddress, subID, keyHash, coordinatorConfig.MinConfs),
"\nRetrieve Request Status: ",
fmt.Sprintf("go run . eoa-load-test-read-metrics --consumer-address=%s", consumerAddress),
"\nA node can now be configured to run a VRF job with the below job spec :\n",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/actions/vrf/common/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
testconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2"
vrf_common_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/common/vrf"
)

func CreateFundAndGetSendingKeys(
Expand Down Expand Up @@ -65,7 +65,7 @@ func CreateAndFundSendingKeys(

func SetupBHSNode(
env *test_env.CLClusterTestEnv,
config *testconfig.General,
config *vrf_common_config.General,
numberOfTxKeysToCreate int,
chainID *big.Int,
coordinatorAddress string,
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/actions/vrf/vrfv2/vrfv2_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func SetupVRFV2Environment(
l zerolog.Logger,
) (*vrfcommon.VRFContracts, []uint64, *vrfcommon.VRFKeyData, map[vrfcommon.VRFNodeType]*vrfcommon.VRFNode, error) {
l.Info().Msg("Starting VRFV2 environment setup")
vrfv2Config := vrfv2TestConfig.GetVRFv2Config().General
configGeneral := vrfv2TestConfig.GetVRFv2Config().General

vrfContracts, subIDs, err := SetupContracts(
env,
Expand All @@ -269,7 +269,7 @@ func SetupVRFV2Environment(
numberOfConsumers,
useVRFOwner,
useTestCoordinator,
vrfv2Config,
configGeneral,
numberOfSubToCreate,
l,
)
Expand Down Expand Up @@ -339,7 +339,7 @@ func SetupVRFV2Environment(
g := errgroup.Group{}
if vrfNode, exists := nodesMap[vrfcommon.VRF]; exists {
g.Go(func() error {
err := setupVRFNode(vrfContracts, chainID, vrfv2Config, pubKeyCompressed, vrfOwnerConfig, l, vrfNode)
err := setupVRFNode(vrfContracts, chainID, configGeneral, pubKeyCompressed, vrfOwnerConfig, l, vrfNode)
if err != nil {
return err
}
Expand All @@ -351,7 +351,7 @@ func SetupVRFV2Environment(
g.Go(func() error {
err := vrfcommon.SetupBHSNode(
env,
vrfv2TestConfig.GetVRFv2Config().General,
configGeneral.General,
numberOfTxKeysToCreate,
chainID,
vrfContracts.CoordinatorV2.Address(),
Expand Down Expand Up @@ -1006,7 +1006,7 @@ func LogRandomnessRequestedEvent(
Str("Request ID", randomWordsRequestedEvent.RequestId.String()).
Uint64("Subscription ID", randomWordsRequestedEvent.SubId).
Str("Sender Address", randomWordsRequestedEvent.Sender.String()).
Interface("Keyhash", randomWordsRequestedEvent.KeyHash).
Str("Keyhash", fmt.Sprintf("0x%x", randomWordsRequestedEvent.KeyHash)).
Uint32("Callback Gas Limit", randomWordsRequestedEvent.CallbackGasLimit).
Uint32("Number of Words", randomWordsRequestedEvent.NumWords).
Uint16("Minimum Request Confirmations", randomWordsRequestedEvent.MinimumRequestConfirmations).
Expand Down
Loading
Loading