diff --git a/.github/workflows/on-demand-vrfv2plus-performance-test.yml b/.github/workflows/on-demand-vrfv2plus-performance-test.yml index 137a4e6333..9714cf13d3 100644 --- a/.github/workflows/on-demand-vrfv2plus-performance-test.yml +++ b/.github/workflows/on-demand-vrfv2plus-performance-test.yml @@ -8,13 +8,8 @@ on: type: string performanceTestType: description: Performance Test Type of test to run - type: choice - options: - - "Smoke" - - "Soak" - - "Load" - - "Stress" - - "Spike" + type: string + required: true test_list_regex: description: "Regex for tests to run" required: false diff --git a/contracts/scripts/native_solc_compile_all_vrf b/contracts/scripts/native_solc_compile_all_vrf index 488fa1f54b..4bfd4ecac7 100755 --- a/contracts/scripts/native_solc_compile_all_vrf +++ b/contracts/scripts/native_solc_compile_all_vrf @@ -82,6 +82,7 @@ compileContract vrf/testhelpers/VRFV2LoadTestWithMetrics.sol compileContract vrf/testhelpers/VRFV2OwnerTestConsumer.sol compileContractAltOpts vrf/testhelpers/VRFCoordinatorTestV2.sol 10000 compileContract vrf/testhelpers/VRFMockETHLINKAggregator.sol +compileContract vrf/testhelpers/Counter.sol # Helper contracts compileContract vrf/interfaces/IAuthorizedReceiver.sol diff --git a/contracts/src/v0.8/vrf/testhelpers/Counter.sol b/contracts/src/v0.8/vrf/testhelpers/Counter.sol new file mode 100644 index 0000000000..1ceb789149 --- /dev/null +++ b/contracts/src/v0.8/vrf/testhelpers/Counter.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +contract Counter { + error AlwaysRevert(); + + uint256 public count = 0; + + function increment() public returns (uint256) { + count += 1; + return count; + } + + function reset() public { + count = 0; + } + + function alwaysRevert() public pure { + revert AlwaysRevert(); + } + + function alwaysRevertWithString() public pure { + revert("always revert"); + } +} diff --git a/core/gethwrappers/generated/counter/counter.go b/core/gethwrappers/generated/counter/counter.go new file mode 100644 index 0000000000..aaa625666d --- /dev/null +++ b/core/gethwrappers/generated/counter/counter.go @@ -0,0 +1,274 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package counter + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +var CounterMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"AlwaysRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"alwaysRevert\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"alwaysRevertWithString\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"increment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60806040526000805534801561001457600080fd5b506101af806100246000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c8063a7bc8cbc11610050578063a7bc8cbc14610091578063d09de08a14610099578063d826f88f146100a157600080fd5b806306661abd1461006c5780639fb3785314610087575b600080fd5b61007560005481565b60405190815260200160405180910390f35b61008f6100aa565b005b61008f6100dc565b610075610142565b61008f60008055565b6040517f8bba4aff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f616c776179732072657665727400000000000000000000000000000000000000604482015260640160405180910390fd5b600060016000808282546101569190610163565b9091555050600054919050565b6000821982111561019d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50019056fea164736f6c6343000806000a", +} + +var CounterABI = CounterMetaData.ABI + +var CounterBin = CounterMetaData.Bin + +func DeployCounter(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Counter, error) { + parsed, err := CounterMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CounterBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Counter{address: address, abi: *parsed, CounterCaller: CounterCaller{contract: contract}, CounterTransactor: CounterTransactor{contract: contract}, CounterFilterer: CounterFilterer{contract: contract}}, nil +} + +type Counter struct { + address common.Address + abi abi.ABI + CounterCaller + CounterTransactor + CounterFilterer +} + +type CounterCaller struct { + contract *bind.BoundContract +} + +type CounterTransactor struct { + contract *bind.BoundContract +} + +type CounterFilterer struct { + contract *bind.BoundContract +} + +type CounterSession struct { + Contract *Counter + CallOpts bind.CallOpts + TransactOpts bind.TransactOpts +} + +type CounterCallerSession struct { + Contract *CounterCaller + CallOpts bind.CallOpts +} + +type CounterTransactorSession struct { + Contract *CounterTransactor + TransactOpts bind.TransactOpts +} + +type CounterRaw struct { + Contract *Counter +} + +type CounterCallerRaw struct { + Contract *CounterCaller +} + +type CounterTransactorRaw struct { + Contract *CounterTransactor +} + +func NewCounter(address common.Address, backend bind.ContractBackend) (*Counter, error) { + abi, err := abi.JSON(strings.NewReader(CounterABI)) + if err != nil { + return nil, err + } + contract, err := bindCounter(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Counter{address: address, abi: abi, CounterCaller: CounterCaller{contract: contract}, CounterTransactor: CounterTransactor{contract: contract}, CounterFilterer: CounterFilterer{contract: contract}}, nil +} + +func NewCounterCaller(address common.Address, caller bind.ContractCaller) (*CounterCaller, error) { + contract, err := bindCounter(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &CounterCaller{contract: contract}, nil +} + +func NewCounterTransactor(address common.Address, transactor bind.ContractTransactor) (*CounterTransactor, error) { + contract, err := bindCounter(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &CounterTransactor{contract: contract}, nil +} + +func NewCounterFilterer(address common.Address, filterer bind.ContractFilterer) (*CounterFilterer, error) { + contract, err := bindCounter(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &CounterFilterer{contract: contract}, nil +} + +func bindCounter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := CounterMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +func (_Counter *CounterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Counter.Contract.CounterCaller.contract.Call(opts, result, method, params...) +} + +func (_Counter *CounterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counter.Contract.CounterTransactor.contract.Transfer(opts) +} + +func (_Counter *CounterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Counter.Contract.CounterTransactor.contract.Transact(opts, method, params...) +} + +func (_Counter *CounterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Counter.Contract.contract.Call(opts, result, method, params...) +} + +func (_Counter *CounterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counter.Contract.contract.Transfer(opts) +} + +func (_Counter *CounterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Counter.Contract.contract.Transact(opts, method, params...) +} + +func (_Counter *CounterCaller) AlwaysRevert(opts *bind.CallOpts) error { + var out []interface{} + err := _Counter.contract.Call(opts, &out, "alwaysRevert") + + if err != nil { + return err + } + + return err + +} + +func (_Counter *CounterSession) AlwaysRevert() error { + return _Counter.Contract.AlwaysRevert(&_Counter.CallOpts) +} + +func (_Counter *CounterCallerSession) AlwaysRevert() error { + return _Counter.Contract.AlwaysRevert(&_Counter.CallOpts) +} + +func (_Counter *CounterCaller) AlwaysRevertWithString(opts *bind.CallOpts) error { + var out []interface{} + err := _Counter.contract.Call(opts, &out, "alwaysRevertWithString") + + if err != nil { + return err + } + + return err + +} + +func (_Counter *CounterSession) AlwaysRevertWithString() error { + return _Counter.Contract.AlwaysRevertWithString(&_Counter.CallOpts) +} + +func (_Counter *CounterCallerSession) AlwaysRevertWithString() error { + return _Counter.Contract.AlwaysRevertWithString(&_Counter.CallOpts) +} + +func (_Counter *CounterCaller) Count(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Counter.contract.Call(opts, &out, "count") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +func (_Counter *CounterSession) Count() (*big.Int, error) { + return _Counter.Contract.Count(&_Counter.CallOpts) +} + +func (_Counter *CounterCallerSession) Count() (*big.Int, error) { + return _Counter.Contract.Count(&_Counter.CallOpts) +} + +func (_Counter *CounterTransactor) Increment(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counter.contract.Transact(opts, "increment") +} + +func (_Counter *CounterSession) Increment() (*types.Transaction, error) { + return _Counter.Contract.Increment(&_Counter.TransactOpts) +} + +func (_Counter *CounterTransactorSession) Increment() (*types.Transaction, error) { + return _Counter.Contract.Increment(&_Counter.TransactOpts) +} + +func (_Counter *CounterTransactor) Reset(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Counter.contract.Transact(opts, "reset") +} + +func (_Counter *CounterSession) Reset() (*types.Transaction, error) { + return _Counter.Contract.Reset(&_Counter.TransactOpts) +} + +func (_Counter *CounterTransactorSession) Reset() (*types.Transaction, error) { + return _Counter.Contract.Reset(&_Counter.TransactOpts) +} + +func (_Counter *Counter) Address() common.Address { + return _Counter.address +} + +type CounterInterface interface { + AlwaysRevert(opts *bind.CallOpts) error + + AlwaysRevertWithString(opts *bind.CallOpts) error + + Count(opts *bind.CallOpts) (*big.Int, error) + + Increment(opts *bind.TransactOpts) (*types.Transaction, error) + + Reset(opts *bind.TransactOpts) (*types.Transaction, error) + + Address() common.Address +} diff --git a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index fd6a034c8a..c12433ee66 100644 --- a/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -26,6 +26,7 @@ blockhash_store: ../../contracts/solc/v0.8.19/BlockhashStore/BlockhashStore.abi chain_module_base: ../../contracts/solc/v0.8.19/ChainModuleBase/ChainModuleBase.abi ../../contracts/solc/v0.8.19/ChainModuleBase/ChainModuleBase.bin 39dfce79330e921e5c169051b11c6e5ea15cd4db5a7b09c06aabbe9658148915 chain_reader_tester: ../../contracts/solc/v0.8.19/ChainReaderTester/ChainReaderTester.abi ../../contracts/solc/v0.8.19/ChainReaderTester/ChainReaderTester.bin de88c7e68de36b96aa2bec844bdc96fcd7c9017b38e25062b3b9f9cec42c814f chain_specific_util_helper: ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.abi ../../contracts/solc/v0.8.6/ChainSpecificUtilHelper/ChainSpecificUtilHelper.bin 66eb30b0717fefe05672df5ec863c0b9a5a654623c4757307a2726d8f31e26b1 +counter: ../../contracts/solc/v0.8.6/Counter/Counter.abi ../../contracts/solc/v0.8.6/Counter/Counter.bin 6ca06e000e8423573ffa0bdfda749d88236ab3da2a4cbb4a868c706da90488c9 cron_upkeep_factory_wrapper: ../../contracts/solc/v0.8.6/CronUpkeepFactory/CronUpkeepFactory.abi - dacb0f8cdf54ae9d2781c5e720fc314b32ed5e58eddccff512c75d6067292cd7 cron_upkeep_wrapper: ../../contracts/solc/v0.8.6/CronUpkeepFactory/CronUpkeep.abi - 362fcfcf30a6ab3acff83095ea4b2b9056dd5e9dcb94bc5411aae58995d22709 dummy_protocol_wrapper: ../../contracts/solc/v0.8.16/DummyProtocol/DummyProtocol.abi ../../contracts/solc/v0.8.16/DummyProtocol/DummyProtocol.bin 583a448170b13abf7ed64e406e8177d78c9e55ab44efd141eee60de23a71ee3b diff --git a/core/gethwrappers/go_generate.go b/core/gethwrappers/go_generate.go index 234c8076f7..c916380cb4 100644 --- a/core/gethwrappers/go_generate.go +++ b/core/gethwrappers/go_generate.go @@ -83,6 +83,7 @@ package gethwrappers //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2LoadTestWithMetrics/VRFV2LoadTestWithMetrics.abi ../../contracts/solc/v0.8.6/VRFV2LoadTestWithMetrics/VRFV2LoadTestWithMetrics.bin VRFV2LoadTestWithMetrics vrf_load_test_with_metrics //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2OwnerTestConsumer/VRFV2OwnerTestConsumer.abi ../../contracts/solc/v0.8.6/VRFV2OwnerTestConsumer/VRFV2OwnerTestConsumer.bin VRFV2OwnerTestConsumer vrf_owner_test_consumer //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFv2Consumer/VRFv2Consumer.abi ../../contracts/solc/v0.8.6/VRFv2Consumer/VRFv2Consumer.bin VRFv2Consumer vrf_v2_consumer_wrapper +//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/Counter/Counter.abi ../../contracts/solc/v0.8.6/Counter/Counter.bin Counter counter //go:generate go run ./generation/generate_link/wrap_link.go diff --git a/integration-tests/actions/actions.go b/integration-tests/actions/actions.go index 2763141a89..b657bacca9 100644 --- a/integration-tests/actions/actions.go +++ b/integration-tests/actions/actions.go @@ -7,6 +7,7 @@ import ( "fmt" "math" "math/big" + "math/rand" "strings" "sync" "testing" @@ -143,11 +144,12 @@ func DecodeTxInputData(abiString string, data []byte) (map[string]interface{}, e // todo - move to CTF func WaitForBlockNumberToBe( + ctx context.Context, waitForBlockNumberToBe uint64, client *seth.Client, wg *sync.WaitGroup, + desiredBlockNumberReached chan<- bool, timeout time.Duration, - t testing.TB, l zerolog.Logger, ) (uint64, error) { blockNumberChannel := make(chan uint64) @@ -166,7 +168,7 @@ func WaitForBlockNumberToBe( waitForBlockNumberToBe, latestBlockNumber) case <-ticker.C: go func() { - currentBlockNumber, err := client.Client.BlockNumber(testcontext.Get(t)) + currentBlockNumber, err := client.Client.BlockNumber(ctx) if err != nil { errorChannel <- err } @@ -180,6 +182,9 @@ func WaitForBlockNumberToBe( if latestBlockNumber >= waitForBlockNumberToBe { ticker.Stop() wg.Done() + if desiredBlockNumberReached != nil { + desiredBlockNumberReached <- true + } l.Info(). Uint64("Latest Block Number", latestBlockNumber). Uint64("Desired Block Number", waitForBlockNumberToBe). @@ -1199,3 +1204,36 @@ func BuildTOMLNodeConfigForK8s(testConfig ctfconfig.GlobalTestConfig, testNetwor return string(asStr), nil } + +func RandBool() bool { + return rand.Intn(2) == 1 +} + +func ContinuouslyGenerateTXsOnChain(sethClient *seth.Client, stopChannel chan bool, l zerolog.Logger) (bool, error) { + counterContract, err := contracts.DeployCounterContract(sethClient) + if err != nil { + return false, err + } + err = counterContract.Reset() + if err != nil { + return false, err + } + var count *big.Int + for { + select { + case <-stopChannel: + l.Info().Str("Number of generated transactions on chain", count.String()).Msg("Stopping generating txs on chain. Desired block number reached.") + return true, nil + default: + err = counterContract.Increment() + if err != nil { + return false, err + } + count, err = counterContract.Count() + if err != nil { + return false, err + } + l.Info().Str("Count", count.String()).Msg("Number of generated transactions on chain") + } + } +} diff --git a/integration-tests/actions/vrf/vrfv2/contract_steps.go b/integration-tests/actions/vrf/vrfv2/contract_steps.go index 4ea49a9b72..324b65b5d6 100644 --- a/integration-tests/actions/vrf/vrfv2/contract_steps.go +++ b/integration-tests/actions/vrf/vrfv2/contract_steps.go @@ -320,7 +320,7 @@ func FundSubscriptions( for _, subID := range subIDs { //Link Billing amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) - err := FundVRFCoordinatorV2Subscription(linkAddress, coordinator, subID, amountJuels) + err := FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) if err != nil { return fmt.Errorf("%s, err %w", vrfcommon.ErrFundSubWithLinkToken, err) } @@ -328,7 +328,7 @@ func FundSubscriptions( return nil } -func FundVRFCoordinatorV2Subscription( +func FundSubscriptionWithLink( linkToken contracts.LinkToken, coordinator contracts.VRFCoordinatorV2, subscriptionID uint64, diff --git a/integration-tests/actions/vrf/vrfv2plus/contract_steps.go b/integration-tests/actions/vrf/vrfv2plus/contract_steps.go index 8d06678690..7e814ccceb 100644 --- a/integration-tests/actions/vrf/vrfv2plus/contract_steps.go +++ b/integration-tests/actions/vrf/vrfv2plus/contract_steps.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog" "github.com/shopspring/decimal" - "github.com/smartcontractkit/seth" "github.com/smartcontractkit/chainlink-testing-framework/utils/conversions" @@ -19,7 +18,7 @@ import ( "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig" - vrfv2plus_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" + vrfv2plusconfig "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus" chainlinkutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" ) @@ -101,7 +100,7 @@ func VRFV2PlusUpgradedVersionRegisterProvingKey( return provingKey, nil } -func FundVRFCoordinatorV2_5Subscription( +func FundSubscriptionWithLink( linkToken contracts.LinkToken, coordinator contracts.VRFCoordinatorV2_5, subscriptionID *big.Int, @@ -127,6 +126,7 @@ func CreateFundSubsAndAddConsumers( coordinator contracts.VRFCoordinatorV2_5, consumers []contracts.VRFv2PlusLoadTestConsumer, numberOfSubToCreate int, + subFundingType string, ) ([]*big.Int, error) { subIDs, err := CreateSubsAndFund( ctx, @@ -136,6 +136,7 @@ func CreateFundSubsAndAddConsumers( linkToken, coordinator, numberOfSubToCreate, + subFundingType, ) if err != nil { return nil, err @@ -162,9 +163,10 @@ func CreateSubsAndFund( subscriptionFundingAmountLink *big.Float, linkToken contracts.LinkToken, coordinator contracts.VRFCoordinatorV2_5, - subAmountToCreate int, + numberOfSubsToCreate int, + subFundingType string, ) ([]*big.Int, error) { - subs, err := CreateSubs(ctx, sethClient, coordinator, subAmountToCreate) + subs, err := CreateSubs(ctx, sethClient, coordinator, numberOfSubsToCreate) if err != nil { return nil, err } @@ -174,6 +176,7 @@ func CreateSubsAndFund( linkToken, coordinator, subs, + subFundingType, ) if err != nil { return nil, err @@ -236,22 +239,43 @@ func FundSubscriptions( linkAddress contracts.LinkToken, coordinator contracts.VRFCoordinatorV2_5, subIDs []*big.Int, + subFundingType string, ) error { for _, subID := range subIDs { - //Native Billing - amountWei := conversions.EtherToWei(subscriptionFundingAmountNative) - err := coordinator.FundSubscriptionWithNative( - subID, - amountWei, - ) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrFundSubWithNativeToken, err) - } - //Link Billing - amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) - err = FundVRFCoordinatorV2_5Subscription(linkAddress, coordinator, subID, amountJuels) - if err != nil { - return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFundSubWithLinkToken, err) + switch vrfv2plusconfig.BillingType(subFundingType) { + case vrfv2plusconfig.BillingType_Link: + amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) + err := FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) + if err != nil { + return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFundSubWithLinkToken, err) + } + case vrfv2plusconfig.BillingType_Native: + amountWei := conversions.EtherToWei(subscriptionFundingAmountNative) + err := coordinator.FundSubscriptionWithNative( + subID, + amountWei, + ) + if err != nil { + return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrFundSubWithNativeToken, err) + } + case vrfv2plusconfig.BillingType_Link_and_Native: + //Native Billing + amountWei := conversions.EtherToWei(subscriptionFundingAmountNative) + err := coordinator.FundSubscriptionWithNative( + subID, + amountWei, + ) + if err != nil { + return fmt.Errorf(vrfcommon.ErrGenericFormat, ErrFundSubWithNativeToken, err) + } + //Link Billing + amountJuels := conversions.EtherToWei(subscriptionFundingAmountLink) + err = FundSubscriptionWithLink(linkAddress, coordinator, subID, amountJuels) + if err != nil { + return fmt.Errorf(vrfcommon.ErrGenericFormat, vrfcommon.ErrFundSubWithLinkToken, err) + } + default: + return fmt.Errorf("invalid billing type: %s", subFundingType) } } return nil @@ -287,7 +311,7 @@ func RequestRandomness( vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, - config *vrfv2plus_config.General, + config *vrfv2plusconfig.General, l zerolog.Logger, keyNum int, ) (*contracts.CoordinatorRandomWordsRequested, error) { @@ -326,7 +350,7 @@ func RequestRandomnessAndWaitForFulfillment( vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, - config *vrfv2plus_config.General, + config *vrfv2plusconfig.General, l zerolog.Logger, keyNum int, ) (*contracts.CoordinatorRandomWordsRequested, *contracts.CoordinatorRandomWordsFulfilled, error) { @@ -380,7 +404,7 @@ func DeployVRFV2PlusDirectFundingContracts( return &VRFV2PlusWrapperContracts{vrfv2PlusWrapper, consumers}, nil } -func WrapperRequestRandomness(consumer contracts.VRFv2PlusWrapperLoadTestConsumer, coordinator contracts.Coordinator, vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, config *vrfv2plus_config.General, l zerolog.Logger) (*contracts.CoordinatorRandomWordsRequested, string, error) { +func WrapperRequestRandomness(consumer contracts.VRFv2PlusWrapperLoadTestConsumer, coordinator contracts.Coordinator, vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, config *vrfv2plusconfig.General, l zerolog.Logger) (*contracts.CoordinatorRandomWordsRequested, string, error) { LogRandRequest( l, consumer.Address(), @@ -430,7 +454,7 @@ func DirectFundingRequestRandomnessAndWaitForFulfillment( vrfKeyData *vrfcommon.VRFKeyData, subID *big.Int, isNativeBilling bool, - config *vrfv2plus_config.General, + config *vrfv2plusconfig.General, l zerolog.Logger, ) (*contracts.CoordinatorRandomWordsFulfilled, error) { randomWordsRequestedEvent, _, err := WrapperRequestRandomness(consumer, coordinator, vrfKeyData, subID, @@ -502,7 +526,7 @@ func SetupVRFV2PlusContracts( sethClient *seth.Client, linkToken contracts.LinkToken, mockNativeLINKFeed contracts.VRFMockETHLINKFeed, - configGeneral *vrfv2plus_config.General, + configGeneral *vrfv2plusconfig.General, l zerolog.Logger, ) (*vrfcommon.VRFContracts, error) { l.Info().Msg("Deploying VRFV2 Plus contracts") @@ -565,6 +589,7 @@ func SetupNewConsumersAndSubs( coordinator, consumers, *testConfig.VRFv2Plus.General.NumberOfSubToCreate, + *testConfig.VRFv2Plus.General.SubscriptionBillingType, ) if err != nil { return nil, nil, fmt.Errorf("err: %w", err) diff --git a/integration-tests/actions/vrf/vrfv2plus/setup_steps.go b/integration-tests/actions/vrf/vrfv2plus/setup_steps.go index 63890c3b9d..8a3661ed11 100644 --- a/integration-tests/actions/vrf/vrfv2plus/setup_steps.go +++ b/integration-tests/actions/vrf/vrfv2plus/setup_steps.go @@ -309,6 +309,7 @@ func SetupVRFV2PlusWrapperEnvironment( linkToken, coordinator, []*big.Int{wrapperSubID}, + *vrfv2PlusConfig.SubscriptionBillingType, ) if err != nil { return nil, nil, err @@ -530,3 +531,16 @@ func SetupSubsAndConsumersForExistingEnv( } return subIDs, consumers, nil } + +func SelectBillingTypeWithDistribution(billingType string, distributionFn func() bool) (bool, error) { + switch vrfv2plus_config.BillingType(billingType) { + case vrfv2plus_config.BillingType_Link: + return false, nil + case vrfv2plus_config.BillingType_Native: + return true, nil + case vrfv2plus_config.BillingType_Link_and_Native: + return distributionFn(), nil + default: + return false, fmt.Errorf("invalid billing type: %s", billingType) + } +} diff --git a/integration-tests/contracts/contract_models.go b/integration-tests/contracts/contract_models.go index e221f3effb..5983f95c9f 100644 --- a/integration-tests/contracts/contract_models.go +++ b/integration-tests/contracts/contract_models.go @@ -244,6 +244,7 @@ type MockGasFeed interface { type BlockHashStore interface { Address() string GetBlockHash(ctx context.Context, blockNumber *big.Int) ([32]byte, error) + StoreVerifyHeader(blockNumber *big.Int, blockHeader []byte) error } type Staking interface { diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index f2dc7e85ee..2db6aeb463 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -20,6 +20,7 @@ import ( ocrTypes "github.com/smartcontractkit/libocr/offchainreporting/types" "github.com/smartcontractkit/seth" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/counter" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/i_automation_registry_master_wrapper_2_3" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_ethusd_aggregator_wrapper" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/weth9_wrapper" @@ -1671,3 +1672,60 @@ func LoadMockETHUSDFeed(client *seth.Client, address common.Address) (MockETHUSD feed: instance, }, nil } + +type Counter struct { + client *seth.Client + instance *counter.Counter + address common.Address +} + +func DeployCounterContract(client *seth.Client) (*Counter, error) { + abi, err := counter.CounterMetaData.GetAbi() + if err != nil { + return &Counter{}, fmt.Errorf("failed to get Counter ABI: %w", err) + } + linkDeploymentData, err := client.DeployContract(client.NewTXOpts(), "Counter", *abi, common.FromHex(counter.CounterMetaData.Bin)) + if err != nil { + return &Counter{}, fmt.Errorf("Counter instance deployment have failed: %w", err) + } + + instance, err := counter.NewCounter(linkDeploymentData.Address, wrappers.MustNewWrappedContractBackend(nil, client)) + if err != nil { + return &Counter{}, fmt.Errorf("failed to instantiate Counter instance: %w", err) + } + + return &Counter{ + client: client, + instance: instance, + address: linkDeploymentData.Address, + }, nil +} + +func (c *Counter) Address() string { + return c.address.Hex() +} + +func (c *Counter) Increment() error { + _, err := c.client.Decode(c.instance.Increment( + c.client.NewTXOpts(), + )) + return err +} + +func (c *Counter) Reset() error { + _, err := c.client.Decode(c.instance.Reset( + c.client.NewTXOpts(), + )) + return err +} + +func (c *Counter) Count() (*big.Int, error) { + data, err := c.instance.Count(&bind.CallOpts{ + From: c.client.Addresses[0], + Context: context.Background(), + }) + if err != nil { + return nil, err + } + return data, nil +} diff --git a/integration-tests/contracts/ethereum_vrf_contracts.go b/integration-tests/contracts/ethereum_vrf_contracts.go index d4757fa869..3a18ae23d0 100644 --- a/integration-tests/contracts/ethereum_vrf_contracts.go +++ b/integration-tests/contracts/ethereum_vrf_contracts.go @@ -365,6 +365,15 @@ func (v *EthereumBlockhashStore) GetBlockHash(ctx context.Context, blockNumber * return blockHash, nil } +func (v *EthereumBlockhashStore) StoreVerifyHeader(blockNumber *big.Int, blockHeader []byte) error { + _, err := v.client.Decode(v.blockHashStore.StoreVerifyHeader( + v.client.NewTXOpts(), + blockNumber, + blockHeader, + )) + return err +} + func (v *EthereumVRFCoordinator) Address() string { return v.address.Hex() } diff --git a/integration-tests/load/vrfv2/vrfv2_test.go b/integration-tests/load/vrfv2/vrfv2_test.go index 0a014ccc44..0075300c7d 100644 --- a/integration-tests/load/vrfv2/vrfv2_test.go +++ b/integration-tests/load/vrfv2/vrfv2_test.go @@ -309,11 +309,12 @@ func TestVRFV2BHSPerformance(t *testing.T) { latestBlockNumber, err := sethClient.Client.BlockNumber(testcontext.Get(t)) require.NoError(t, err) _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), latestBlockNumber+uint64(257), sethClient, &wgBlockNumberTobe, + nil, configCopy.VRFv2.General.WaitFor256BlocksTimeout.Duration, - t, l, ) wgBlockNumberTobe.Wait() diff --git a/integration-tests/load/vrfv2plus/gun.go b/integration-tests/load/vrfv2plus/gun.go index 79f477294b..430e9f5ff1 100644 --- a/integration-tests/load/vrfv2plus/gun.go +++ b/integration-tests/load/vrfv2plus/gun.go @@ -1,7 +1,6 @@ package loadvrfv2plus import ( - "fmt" "math/big" "math/rand" @@ -10,6 +9,7 @@ import ( "github.com/smartcontractkit/wasp" seth_utils "github.com/smartcontractkit/chainlink-testing-framework/utils/seth" + "github.com/smartcontractkit/chainlink/integration-tests/actions" vrfcommon "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/common" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv2plus" @@ -46,7 +46,7 @@ func NewBHSTestGun( // Call implements example gun call, assertions on response bodies should be done here func (m *BHSTestGun) Call(_ *wasp.Generator) *wasp.Response { vrfv2PlusConfig := m.testConfig.General - billingType, err := selectBillingType(*vrfv2PlusConfig.SubscriptionBillingType) + billingType, err := vrfv2plus.SelectBillingTypeWithDistribution(*vrfv2PlusConfig.SubscriptionBillingType, actions.RandBool) if err != nil { return &wasp.Response{Error: err.Error(), Failed: true} } @@ -101,7 +101,7 @@ func NewSingleHashGun( func (m *SingleHashGun) Call(_ *wasp.Generator) *wasp.Response { //todo - should work with multiple consumers and consumers having different keyhashes and wallets vrfv2PlusConfig := m.testConfig.General - billingType, err := selectBillingType(*vrfv2PlusConfig.SubscriptionBillingType) + billingType, err := vrfv2plus.SelectBillingTypeWithDistribution(*vrfv2PlusConfig.SubscriptionBillingType, actions.RandBool) if err != nil { return &wasp.Response{Error: err.Error(), Failed: true} } @@ -128,7 +128,7 @@ func (m *SingleHashGun) Call(_ *wasp.Generator) *wasp.Response { } func deviateValue(requestCountPerTX uint16, deviation uint16) uint16 { - if randBool() && requestCountPerTX > deviation { + if actions.RandBool() && requestCountPerTX > deviation { requestCountPerTX -= uint16(randInRange(0, int(deviation))) } else { requestCountPerTX += uint16(randInRange(0, int(deviation))) @@ -136,22 +136,6 @@ func deviateValue(requestCountPerTX uint16, deviation uint16) uint16 { return requestCountPerTX } -func randBool() bool { - return rand.Intn(2) == 1 -} func randInRange(min int, max int) int { return rand.Intn(max-min+1) + min } - -func selectBillingType(billingType string) (bool, error) { - switch vrfv2plus_config.BillingType(billingType) { - case vrfv2plus_config.BillingType_Link: - return false, nil - case vrfv2plus_config.BillingType_Native: - return true, nil - case vrfv2plus_config.BillingType_Link_and_Native: - return randBool(), nil - default: - return false, fmt.Errorf("invalid billing type: %s", billingType) - } -} diff --git a/integration-tests/load/vrfv2plus/vrfv2plus_test.go b/integration-tests/load/vrfv2plus/vrfv2plus_test.go index 3835dbfb61..e8e1d7779c 100644 --- a/integration-tests/load/vrfv2plus/vrfv2plus_test.go +++ b/integration-tests/load/vrfv2plus/vrfv2plus_test.go @@ -311,11 +311,12 @@ func TestVRFV2PlusBHSPerformance(t *testing.T) { latestBlockNumber, err := sethClient.Client.BlockNumber(testcontext.Get(t)) require.NoError(t, err, "error getting latest block number") _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), latestBlockNumber+uint64(257), sethClient, &wgBlockNumberTobe, + nil, configCopy.VRFv2Plus.General.WaitFor256BlocksTimeout.Duration, - t, l, ) wgBlockNumberTobe.Wait() @@ -334,13 +335,15 @@ func TestVRFV2PlusBHSPerformance(t *testing.T) { Float64("SubscriptionRefundingAmountNative", *configCopy.VRFv2Plus.General.SubscriptionRefundingAmountNative). Float64("SubscriptionRefundingAmountLink", *configCopy.VRFv2Plus.General.SubscriptionRefundingAmountLink). Strs("SubIDs", subIDsString). - Msg("Funding Subscriptions with Link and Native Tokens") + Str("Funding type", *configCopy.VRFv2Plus.General.SubscriptionBillingType). + Msg("Funding Subscriptions with Link and/or Native Tokens") err = vrfv2plus.FundSubscriptions( big.NewFloat(*configCopy.VRFv2Plus.General.SubscriptionRefundingAmountNative), big.NewFloat(*configCopy.VRFv2Plus.General.SubscriptionRefundingAmountLink), vrfContracts.LinkToken, vrfContracts.CoordinatorV2Plus, underfundedSubIDs, + *configCopy.VRFv2Plus.General.SubscriptionBillingType, ) require.NoError(t, err, "error funding subscriptions") diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index 0cf04051e7..cf3bc9431d 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -900,11 +900,12 @@ func TestVRFV2WithBHS(t *testing.T) { wg.Add(1) //Wait at least 256 blocks _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), randRequestBlockNumber+uint64(257), sethClient, &wg, + nil, configCopy.VRFv2.General.WaitFor256BlocksTimeout.Duration, - t, l, ) wg.Wait() @@ -970,11 +971,12 @@ func TestVRFV2WithBHS(t *testing.T) { var wg sync.WaitGroup wg.Add(1) _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), randRequestBlockNumber+uint64(*configCopy.VRFv2.General.BHSJobWaitBlocks), sethClient, &wg, + nil, time.Minute*1, - t, l, ) wg.Wait() diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 106b4f3c1c..b0deaa3c9c 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -1329,23 +1329,40 @@ func TestVRFV2PlusWithBHS(t *testing.T) { randRequestBlockNumber := randomWordsRequestedEvent.Raw.BlockNumber var wg sync.WaitGroup wg.Add(1) - //Wait at least 256 blocks - _, err = actions.WaitForBlockNumberToBe( - randRequestBlockNumber+uint64(257), - sethClient, - &wg, - configCopy.VRFv2Plus.General.WaitFor256BlocksTimeout.Duration, - t, - l, - ) + + waitForNumberOfBlocks := 257 + desiredBlockNumberReached := make(chan bool) + go func() { + //Wait at least 256 blocks + _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), + randRequestBlockNumber+uint64(waitForNumberOfBlocks), + sethClient, + &wg, + desiredBlockNumberReached, + configCopy.VRFv2Plus.General.WaitFor256BlocksTimeout.Duration, + l, + ) + require.NoError(t, err) + }() + + if *configCopy.VRFv2Plus.General.GenerateTXsOnChain { + go func() { + _, err := actions.ContinuouslyGenerateTXsOnChain(sethClient, desiredBlockNumberReached, l) + require.NoError(t, err) + // Wait to let the transactions be mined and avoid nonce issues + time.Sleep(time.Second * 5) + }() + } wg.Wait() - require.NoError(t, err) + err = vrfv2plus.FundSubscriptions( big.NewFloat(*configCopy.VRFv2Plus.General.SubscriptionRefundingAmountNative), big.NewFloat(*configCopy.VRFv2Plus.General.SubscriptionRefundingAmountLink), vrfContracts.LinkToken, vrfContracts.CoordinatorV2Plus, subIDs, + *configCopy.VRFv2Plus.General.SubscriptionBillingType, ) require.NoError(t, err, "error funding subscriptions") randomWordsFulfilledEvent, err := vrfContracts.CoordinatorV2Plus.WaitForRandomWordsFulfilledEvent( @@ -1368,6 +1385,7 @@ func TestVRFV2PlusWithBHS(t *testing.T) { l.Info(). Str("Randomness Request's Blockhash", randomWordsRequestedEvent.Raw.BlockHash.String()). Str("Block Hash stored by BHS contract", fmt.Sprintf("0x%x", randRequestBlockHash)). + Str("BHS Contract", vrfContracts.BHS.Address()). Msg("BHS Contract's stored Blockhash for Randomness Request") require.Equal(t, 0, randomWordsRequestedEvent.Raw.BlockHash.Cmp(randRequestBlockHash)) }) @@ -1414,11 +1432,12 @@ func TestVRFV2PlusWithBHS(t *testing.T) { var wg sync.WaitGroup wg.Add(1) _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), randRequestBlockNumber+uint64(*configCopy.VRFv2Plus.General.BHSJobWaitBlocks+10), sethClient, &wg, + nil, time.Minute*1, - t, l, ) wg.Wait() @@ -1565,11 +1584,12 @@ func TestVRFV2PlusWithBHF(t *testing.T) { wg.Add(1) //Wait at least 256 blocks _, err = actions.WaitForBlockNumberToBe( + testcontext.Get(t), randRequestBlockNumber+uint64(257), sethClient, &wg, + nil, configCopy.VRFv2Plus.General.WaitFor256BlocksTimeout.Duration, - t, l, ) wg.Wait() @@ -1583,6 +1603,7 @@ func TestVRFV2PlusWithBHF(t *testing.T) { vrfContracts.LinkToken, vrfContracts.CoordinatorV2Plus, subIDs, + *configCopy.VRFv2Plus.General.SubscriptionBillingType, ) require.NoError(t, err, "error funding subscriptions") randomWordsFulfilledEvent, err := vrfContracts.CoordinatorV2Plus.WaitForRandomWordsFulfilledEvent( @@ -1721,6 +1742,7 @@ func TestVRFv2PlusReplayAfterTimeout(t *testing.T) { vrfContracts.LinkToken, vrfContracts.CoordinatorV2Plus, []*big.Int{subID}, + *configCopy.VRFv2Plus.General.SubscriptionBillingType, ) require.NoError(t, err, "error funding subs after request timeout") diff --git a/integration-tests/testconfig/common/vrf/common.go b/integration-tests/testconfig/common/vrf/common.go index a5b4078f42..e213191075 100644 --- a/integration-tests/testconfig/common/vrf/common.go +++ b/integration-tests/testconfig/common/vrf/common.go @@ -182,6 +182,8 @@ type General struct { BHFJobLookBackBlocks *int `toml:"bhf_job_lookback_blocks"` BHFJobPollPeriod *blockchain.StrDuration `toml:"bhf_job_poll_period"` BHFJobRunTimeout *blockchain.StrDuration `toml:"bhf_job_run_timeout"` + + GenerateTXsOnChain *bool `toml:"generate_txs_on_chain"` } func (c *General) Validate() error { @@ -299,5 +301,25 @@ func (c *General) Validate() error { return errors.New("bhs_job_wait_blocks must be set to a non-negative value") } + if c.BHFJobLookBackBlocks == nil || *c.BHFJobLookBackBlocks < 0 { + return errors.New("bhf_job_lookback_blocks must be set to a non-negative value") + } + + if c.BHFJobPollPeriod == nil || c.BHFJobPollPeriod.Duration == 0 { + return errors.New("bhf_job_poll_period must be set to a non-negative value") + } + + if c.BHFJobRunTimeout == nil || c.BHFJobRunTimeout.Duration == 0 { + return errors.New("bhf_job_run_timeout must be set to a non-negative value") + } + + if c.BHFJobWaitBlocks == nil || *c.BHFJobWaitBlocks < 0 { + return errors.New("bhf_job_wait_blocks must be set to a non-negative value") + } + + if c.GenerateTXsOnChain == nil { + return errors.New("generate_txs_on_chain must not be nil") + } + return nil } diff --git a/integration-tests/testconfig/vrfv2/vrfv2.toml b/integration-tests/testconfig/vrfv2/vrfv2.toml index 4ff48a3181..011e90c15f 100644 --- a/integration-tests/testconfig/vrfv2/vrfv2.toml +++ b/integration-tests/testconfig/vrfv2/vrfv2.toml @@ -59,6 +59,7 @@ cl_node_max_gas_price_gwei = 10 link_native_feed_response = 1000000000000000000 #todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request minimum_confirmations = 3 +generate_txs_on_chain = false number_of_words = 3 callback_gas_limit = 1000000 @@ -102,6 +103,12 @@ bhs_job_lookback_blocks = 250 bhs_job_poll_period = "1s" bhs_job_run_timeout = "24h" +# BHF Job config +bhf_job_wait_blocks = 260 +bhf_job_lookback_blocks = 500 +bhf_job_poll_period = "30s" +bhf_job_run_timeout = "1h" + # PERFORMANCE test specific config [VRFv2.ExistingEnv] diff --git a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml b/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml index 1d2af76084..1883758112 100644 --- a/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml +++ b/integration-tests/testconfig/vrfv2plus/vrfv2plus.toml @@ -67,6 +67,7 @@ use_existing_env = false minimum_confirmations = 3 # Can be "LINK", "NATIVE" or "LINK_AND_NATIVE" subscription_billing_type = "LINK_AND_NATIVE" +generate_txs_on_chain = false #CL Node config cl_node_max_gas_price_gwei = 10 @@ -123,6 +124,12 @@ bhs_job_lookback_blocks = 250 bhs_job_poll_period = "1s" bhs_job_run_timeout = "24h" +# BHF Job config +bhf_job_wait_blocks = 260 +bhf_job_lookback_blocks = 500 +bhf_job_poll_period = "30s" +bhf_job_run_timeout = "1h" + # PERFORMANCE test specific config [VRFv2Plus.ExistingEnv] @@ -148,16 +155,16 @@ bhs_test_rps = 1 chainlink_node_funding = 0.1 [Soak.VRFv2Plus.General] -randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request -randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +randomness_request_count_per_request = 4 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting number_of_sub_to_create = 1 number_of_sending_keys_to_create = 0 -subscription_funding_amount_link = 5.0 -subscription_funding_amount_native=1 +subscription_funding_amount_link = 50 +subscription_funding_amount_native=10 [Soak.VRFv2Plus.Performance] test_duration = "2m" -rate_limit_unit_duration = "3s" +rate_limit_unit_duration = "10s" rps = 1 bhs_test_duration = "1m" bhs_test_rate_limit_unit_duration = "3s" @@ -735,7 +742,6 @@ rps = 1 ### BSC SEPOLIA Config [BSC_TESTNET.VRFv2Plus.General] -use_existing_env = true #todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request minimum_confirmations = 3 @@ -850,3 +856,346 @@ subscription_funding_amount_native = 0.1 test_duration = "2m" rate_limit_unit_duration = "3s" rps = 1 + + +### NEXON QA Config +[NEXON_QA.VRFv2Plus.General] +#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request +minimum_confirmations = 0 +generate_txs_on_chain = true + +# Consumer Request config +subscription_billing_type = "LINK_AND_NATIVE" +callback_gas_limit = 1000000 + +[NEXON_QA.VRFv2Plus.ExistingEnv] +coordinator_address = "0xF1F0beBcc284591FCD28d8f2BAc9f30efdA3E0ea" +consumer_address = "" +sub_id = "" +key_hash = "0x7d5692e71807c4c02f5a109627a9ad2b12a361a346790a306983af9a5e3a186f" +create_fund_subs_and_add_consumers = true +link_address = "0x92Bd61014c5BDc4A43BBbaAEa63d0694BE43ECDd" +node_sending_key_funding_min = 30 +node_sending_keys = [ + "0xB97c0C52A2B957b45DA213e652c76090DDd0FEc6", + "0xe205F5d4a99ca0f474d0b4d12f60a0153c786B4E", + # BHS + "0xf85E291edF0352435f2fD5e817030f6542375a99", +] + +#SMOKE TEST CONFIG +[NEXON_QA-Smoke.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 21 +subscription_funding_amount_native = 2 +subscription_refunding_amount_link = 21 +subscription_refunding_amount_native = 2 +number_of_words = 1 +random_words_fulfilled_event_timeout = "1m30s" +wait_for_256_blocks_timeout = "25m" +wrapper_consumer_funding_amount_link = 21 +wrapper_consumer_funding_amount_native_token = 3 + + +[NEXON_QA-Smoke.VRFv2Plus.Performance] +test_duration = "2s" +rate_limit_unit_duration = "3s" +rps = 1 + + +#SOAK TEST CONFIG +[NEXON_QA-Soak.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 400 +subscription_funding_amount_native = 200 + +[NEXON_QA-Soak.VRFv2Plus.Performance] +test_duration = "5h" +rate_limit_unit_duration = "3s" +rps = 1 + +# LOAD TEST CONFIG +[NEXON_QA-Load.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 300 +subscription_funding_amount_native = 300 + +[NEXON_QA-Load.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +# STRESS TEST CONFIG +[NEXON_QA-Stress.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 5.0 +subscription_funding_amount_native = 2 + +[NEXON_QA-Stress.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + +### NEXON DEV Config +[NEXON_DEV.VRFv2Plus.General] +#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request +minimum_confirmations = 0 +generate_txs_on_chain = true + +# Consumer Request config +subscription_billing_type = "LINK_AND_NATIVE" +callback_gas_limit = 1000000 + +[NEXON_DEV.VRFv2Plus.ExistingEnv] +coordinator_address = "0x6901d7236A823E7B7911d90FBe46E6FA770CC823" +consumer_address = "" +sub_id = "" +key_hash = "0xdc023892a41e5fe74ec7c4c2e8c0a808b01aea7acaf2b2ae30f4e08df877c48b" +create_fund_subs_and_add_consumers = true +link_address = "0xE4DDEDb5A220eC218791dC35b1b4D737ba813EE7" +node_sending_key_funding_min = 30 +node_sending_keys = [ + "0xF3d9879a75BBD85890056D7c6cB37C555F9b41A3", + # BHS + "0xb544f9D7c16a30af0EEd0afcC4132D1c63bAF8AC", +] + +#SMOKE TEST CONFIG +[NEXON_DEV-Smoke.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 21 +subscription_funding_amount_native = 2 +subscription_refunding_amount_link = 21 +subscription_refunding_amount_native = 2 +number_of_words = 1 +random_words_fulfilled_event_timeout = "1m30s" +wait_for_256_blocks_timeout = "25m" +wrapper_consumer_funding_amount_link = 21 +wrapper_consumer_funding_amount_native_token = 3 + +[NEXON_DEV-Smoke.VRFv2Plus.Performance] +test_duration = "2s" +rate_limit_unit_duration = "3s" +rps = 1 + + +#SOAK TEST CONFIG +[NEXON_DEV-Soak.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 400 +subscription_funding_amount_native = 200 + +[NEXON_DEV-Soak.VRFv2Plus.Performance] +test_duration = "5h" +rate_limit_unit_duration = "3s" +rps = 1 + +# LOAD TEST CONFIG +[NEXON_DEV-Load.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 300 +subscription_funding_amount_native = 300 + +[NEXON_DEV-Load.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +# STRESS TEST CONFIG +[NEXON_DEV-Stress.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 5.0 +subscription_funding_amount_native = 0.1 + +[NEXON_DEV-Stress.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +### NEXON TEST Config +[NEXON_TEST.VRFv2Plus.General] +#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request +minimum_confirmations = 0 +generate_txs_on_chain = true + +# Consumer Request config +subscription_billing_type = "LINK_AND_NATIVE" +callback_gas_limit = 1000000 + +[NEXON_TEST.VRFv2Plus.ExistingEnv] +coordinator_address = "0xAa92Ba21168B48195cAdB87cfaB3eB70B2499F55" +consumer_address = "" +sub_id = "" +key_hash = "0x0cb2a18e8b762cb4c8f7b17a6cc02ac7b9d2a3346f048cfd2f5d37677f8747d8" +create_fund_subs_and_add_consumers = true +link_address = "0xD694472F1CD02E1f3fc3534386bda6802fCFe0f7" +node_sending_key_funding_min = 30 +node_sending_keys = [ + "0xBFD780Af421e98C35918e10B9d6da7389C3e1D10", + "0xbf6c76024672F233aB8164EC00683e1AE774F6b0", + # BHS + "0x2a3900Ac77de110670E060DBFf4fCbe36c6f8170", +] + +#SMOKE TEST CONFIG +[NEXON_TEST-Smoke.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 21 +subscription_funding_amount_native = 2 +subscription_refunding_amount_link = 21 +subscription_refunding_amount_native = 2 +number_of_words = 1 +random_words_fulfilled_event_timeout = "1m30s" +wait_for_256_blocks_timeout = "25m" +wrapper_consumer_funding_amount_link = 5 +wrapper_consumer_funding_amount_native_token = 3 + +[NEXON_TEST-Smoke.VRFv2Plus.Performance] +test_duration = "2s" +rate_limit_unit_duration = "3s" +rps = 1 + + +#SOAK TEST CONFIG +[NEXON_TEST-Soak.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 400 +subscription_funding_amount_native = 200 + +[NEXON_TEST-Soak.VRFv2Plus.Performance] +test_duration = "5h" +rate_limit_unit_duration = "3s" +rps = 1 + +# LOAD TEST CONFIG +[NEXON_TEST-Load.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 300 +subscription_funding_amount_native = 300 + +[NEXON_TEST-Load.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +# STRESS TEST CONFIG +[NEXON_TEST-Stress.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 5.0 +subscription_funding_amount_native = 0.1 + +[NEXON_TEST-Stress.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +### NEXON STAGE Config +[NEXON_STAGE.VRFv2Plus.General] +#todo - need to have separate minimum_confirmations config for Coordinator, CL Node and Consumer request +minimum_confirmations = 0 +generate_txs_on_chain = true + +# Consumer Request config +subscription_billing_type = "LINK_AND_NATIVE" +callback_gas_limit = 1000000 + +[NEXON_STAGE.VRFv2Plus.ExistingEnv] +coordinator_address = "0xF705dD3e7E717F32de0Cc5F833f8009f16122AD1" +consumer_address = "" +sub_id = "" +key_hash = "0xbc9f525e3e1d9e2336f7c77d5f33f5b60aab3765944617fed7f66a6afecac616" +create_fund_subs_and_add_consumers = true +link_address = "0x8E3f5E6dFeb4498437149b0d347ef51427dB1DE2" +node_sending_key_funding_min = 30 +node_sending_keys = [ +] + +#SMOKE TEST CONFIG +[NEXON_STAGE-Smoke.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 21 +subscription_funding_amount_native = 2 +subscription_refunding_amount_link = 21 +subscription_refunding_amount_native = 2 +number_of_words = 1 +random_words_fulfilled_event_timeout = "1m30s" +wait_for_256_blocks_timeout = "25m" +wrapper_consumer_funding_amount_link = 21 +wrapper_consumer_funding_amount_native_token = 3 + +[NEXON_STAGE-Smoke.VRFv2Plus.Performance] +test_duration = "2s" +rate_limit_unit_duration = "3s" +rps = 1 + + +#SOAK TEST CONFIG +[NEXON_STAGE-Soak.VRFv2Plus.General] +randomness_request_count_per_request = 1 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 0 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 400 +subscription_funding_amount_native = 200 + +[NEXON_STAGE-Soak.VRFv2Plus.Performance] +test_duration = "5h" +rate_limit_unit_duration = "3s" +rps = 1 + +# LOAD TEST CONFIG +[NEXON_STAGE-Load.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 300 +subscription_funding_amount_native = 300 + +[NEXON_STAGE-Load.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1 + + +# STRESS TEST CONFIG +[NEXON_STAGE-Stress.VRFv2Plus.General] +randomness_request_count_per_request = 3 # amount of randomness requests to make per one TX request +randomness_request_count_per_request_deviation = 2 #NOTE - deviation should be less than randomness_request_count_per_request setting +number_of_sub_to_create = 1 +subscription_funding_amount_link = 5.0 +subscription_funding_amount_native = 0.1 + +[NEXON_STAGE-Stress.VRFv2Plus.Performance] +test_duration = "2m" +rate_limit_unit_duration = "3s" +rps = 1