From 5bcd414622294d8142e6cfff08f8c1b0c2dc72df Mon Sep 17 00:00:00 2001 From: Ilja Pavlovs Date: Tue, 14 Nov 2023 15:26:34 -0400 Subject: [PATCH] =?UTF-8?q?VRF-749:=20updating=20setup-env=20script=20for?= =?UTF-8?q?=20VRF=20to=20include=20chainId=20when=20cr=E2=80=A6=20(#11286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * VRF-749: updating setup-env script for VRF to include chainId when creating eth keys; README update * VRF-749: updating README.md --- core/scripts/common/vrf/setup-envs/README.md | 83 ++++++++++++++++++-- core/scripts/common/vrf/setup-envs/main.go | 2 + 2 files changed, 80 insertions(+), 5 deletions(-) diff --git a/core/scripts/common/vrf/setup-envs/README.md b/core/scripts/common/vrf/setup-envs/README.md index f3b391f0eed..9aa76ffbbb7 100644 --- a/core/scripts/common/vrf/setup-envs/README.md +++ b/core/scripts/common/vrf/setup-envs/README.md @@ -15,6 +15,7 @@ export ETH_CHAIN_ID= export ACCOUNT_KEY= ``` 5. execute from `core/scripts/common/vrf/setup-envs` folder + * `--vrf-version` - "v2" or "v2plus" ``` go run . \ --vrf-version="v2plus" \ @@ -28,24 +29,96 @@ go run . \ --bhs-bk-creds-file \ --bhf-node-url=http://localhost:6614 \ --bhf-creds-file \ +--num-eth-keys=1 \ +--num-vrf-keys=1 \ +--sending-key-funding-amount="1e17" \ --deploy-contracts-and-create-jobs="true" \ --subscription-balance="1e19" \ --subscription-balance-native="1e18" \ --batch-fulfillment-enabled="true" \ --min-confs=3 \ ---num-eth-keys=1 \ ---num-vrf-keys=1 \ ---sending-key-funding-amount="1e17" \ --register-vrf-key-against-address= ``` -Optional parameters - will not be deployed if specified (NOT WORKING YET) +Optional parameters - will not be deployed if specified ``` --link-address
\ --link-eth-feed
\ +``` + +WIP - Not working yet: +``` --bhs-address
\ --batch-bhs-address
\ --coordinator-address
\ --batch-coordinator-address
-``` \ No newline at end of file +``` + + +## Process Example + +1. If the CL nodes do not have needed amount of ETH and VRF keys, you need to create them first: +``` +go run . \ +--vrf-version="v2" \ +--vrf-primary-node-url= \ +--vrf-primary-creds-file \ +--bhs-node-url= \ +--bhs-creds-file \ +--num-eth-keys=3 \ +--num-vrf-keys=1 \ +--sending-key-funding-amount="1e17" \ +--deploy-contracts-and-create-jobs="false" +``` +Then update corresponding deployment scripts with the new ETH addresses, specifying max gas price for each key + +e.g.: +``` +[[EVM.KeySpecific]] +Key = '' +GasEstimator.PriceMax = '30 gwei' +``` + +2. If the CL nodes already have needed amount of ETH and VRF keys, you can deploy contracts and create jobs with the following command: +NOTE - nodes will be funded at least to the amount specified in `--sending-key-funding-amount` parameter. +``` +go run . \ +--vrf-version="v2" \ +--vrf-primary-node-url= \ +--vrf-primary-creds-file \ +--bhs-node-url= \ +--bhs-creds-file \ +--num-eth-keys=3 \ +--num-vrf-keys=1 \ +--sending-key-funding-amount="1e17" \ +--deploy-contracts-and-create-jobs="true" \ +--subscription-balance="1e19" \ +--subscription-balance-native="1e18" \ +--batch-fulfillment-enabled="true" \ +--min-confs=3 \ +--register-vrf-key-against-address="" \ +--link-address "" \ +--link-eth-feed "" +``` + + +3. We can run sample rand request to see if the setup works. + After previous script was done, we should see the command to run in the console: + + e.g. to trigger rand request: + 1. navigate to `core/scripts/vrfv2plus/testnet` or `core/scripts/vrfv2/testnet` folder + 2. set needed env variables + ``` + export ETH_URL= + export ETH_CHAIN_ID= + export ACCOUNT_KEY= + ``` + 3. Trigger rand request (get this command from the console after running `setup-envs` script ) + ```bash + go run . eoa-load-test-request-with-metrics --consumer-address= --sub-id=1 --key-hash= --request-confirmations <> --requests 1 --runs 1 --cb-gas-limit 1_000_000 + ``` + 4. Then to check that rand request was fulfilled (get this command from the console after running `setup-envs` script ) + ```bash + go run . eoa-load-test-read-metrics --consumer-address= + ``` \ No newline at end of file diff --git a/core/scripts/common/vrf/setup-envs/main.go b/core/scripts/common/vrf/setup-envs/main.go index 7c2530ffd47..94662aa1831 100644 --- a/core/scripts/common/vrf/setup-envs/main.go +++ b/core/scripts/common/vrf/setup-envs/main.go @@ -506,6 +506,8 @@ func createETHKeysIfNeeded(client *clcmd.Shell, app *cli.App, output *bytes.Buff if *maxGasPriceGwei > 0 { helpers.PanicErr(flagSet.Set("max-gas-price-gwei", fmt.Sprintf("%d", *maxGasPriceGwei))) } + err := flagSet.Parse([]string{"-evm-chain-id", os.Getenv("ETH_CHAIN_ID")}) + helpers.PanicErr(err) err = client.CreateETHKey(cli.NewContext(app, flagSet, nil)) helpers.PanicErr(err) helpers.PanicErr(json.Unmarshal(output.Bytes(), &newKey))