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-858: small refactoring - rename CTF VRF V2 and V2.5 packages #11877

Merged
merged 13 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ jobs:
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf-evm-simulated
- name: vrfv2
nodes: 2
nodes: 3
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2-evm-simulated
- name: vrfv2plus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ocr2vrf_actions
package ocr2vrf

import (
"crypto/ed25519"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ocr2vrf_actions
package ocr2vrf

import ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ocr2vrf_actions
package ocr2vrf

import (
"math/big"
Expand All @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"

ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/ocr2vrf/ocr2vrf_constants"

"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vrfv2_actions
package vrfv2

import (
"math/big"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vrfv2_actions
package vrfv2

import (
"context"
Expand Down
14 changes: 7 additions & 7 deletions integration-tests/chaos/ocr2vrf_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils/ptr"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/ocr2vrf"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/ocr2vrf/ocr2vrf_constants"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/config"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
Expand Down Expand Up @@ -130,8 +130,8 @@ func TestOCR2VRFChaos(t *testing.T) {
//},
}

for testCaseName, tc := range testCases {
testCase := tc
for testCaseName, test := range testCases {
testCase := test
t.Run(fmt.Sprintf("OCR2VRF_%s", testCaseName), func(t *testing.T) {
t.Parallel()
testNetwork := networks.MustGetSelectedNetworkConfig(testconfig.Network)[0] // Need a new copy of the network for each test
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestOCR2VRFChaos(t *testing.T) {
mockETHLinkFeed, err := contractDeployer.DeployMockETHLINKFeed(ocr2vrf_constants.LinkEthFeedResponse)
require.NoError(t, err, "Error deploying Mock ETH/LINK Feed")

_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse(
_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf.SetupOCR2VRFUniverse(
t,
linkToken,
mockETHLinkFeed,
Expand All @@ -189,7 +189,7 @@ func TestOCR2VRFChaos(t *testing.T) {
)

//Request and Redeem Randomness to verify that process works fine
requestID := ocr2vrf_actions.RequestAndRedeemRandomness(
requestID := ocr2vrf.RequestAndRedeemRandomness(
t,
consumerContract,
chainClient,
Expand All @@ -216,7 +216,7 @@ func TestOCR2VRFChaos(t *testing.T) {
l.Info().Msg("Chaos Recovered")

//Request and Redeem Randomness again to see that after Chaos Experiment whole process is still working
requestID = ocr2vrf_actions.RequestAndRedeemRandomness(
requestID = ocr2vrf.RequestAndRedeemRandomness(
t,
consumerContract,
chainClient,
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/load/vrfv2/gun.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import (
"github.com/rs/zerolog"
"github.com/smartcontractkit/wasp"

"github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2_actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv2"
"github.com/smartcontractkit/chainlink/integration-tests/types"
)

/* SingleHashGun is a gun that constantly requests randomness for one feed */

type SingleHashGun struct {
contracts *vrfv2_actions.VRFV2Contracts
contracts *vrfv2.VRFV2Contracts
keyHash [32]byte
subIDs []uint64
testConfig types.VRFv2TestConfig
logger zerolog.Logger
}

func NewSingleHashGun(
contracts *vrfv2_actions.VRFV2Contracts,
contracts *vrfv2.VRFV2Contracts,
keyHash [32]byte,
subIDs []uint64,
testConfig types.VRFv2TestConfig,
Expand All @@ -43,14 +43,14 @@ func (m *SingleHashGun) Call(_ *wasp.Generator) *wasp.Response {
vrfv2Config := m.testConfig.GetVRFv2Config().General
//randomly increase/decrease randomness request count per TX
randomnessRequestCountPerRequest := deviateValue(*vrfv2Config.RandomnessRequestCountPerRequest, *vrfv2Config.RandomnessRequestCountPerRequestDeviation)
_, err := vrfv2_actions.RequestRandomnessAndWaitForFulfillment(
_, err := vrfv2.RequestRandomnessAndWaitForFulfillment(
m.logger,
//the same consumer is used for all requests and in all subs
m.contracts.LoadTestConsumers[0],
m.contracts.Coordinator,
//randomly pick a subID from pool of subIDs
m.subIDs[randInRange(0, len(m.subIDs)-1)],
&vrfv2_actions.VRFV2Data{VRFV2KeyData: vrfv2_actions.VRFV2KeyData{KeyHash: m.keyHash}},
&vrfv2.VRFV2Data{VRFV2KeyData: vrfv2.VRFV2KeyData{KeyHash: m.keyHash}},
*vrfv2Config.MinimumConfirmations,
*vrfv2Config.CallbackGasLimit,
*vrfv2Config.NumberOfWords,
Expand Down
24 changes: 12 additions & 12 deletions integration-tests/load/vrfv2/vrfv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/utils/conversions"
"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv2"

"github.com/smartcontractkit/chainlink/integration-tests/contracts"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
"github.com/smartcontractkit/chainlink/integration-tests/testreporters"

"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2_actions"
tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig"
)

var (
env *test_env.CLClusterTestEnv
vrfv2Contracts *vrfv2_actions.VRFV2Contracts
vrfv2Data *vrfv2_actions.VRFV2Data
vrfv2Contracts *vrfv2.VRFV2Contracts
vrfv2Data *vrfv2.VRFV2Data
subIDs []uint64
eoaWalletAddress string

Expand Down Expand Up @@ -110,15 +110,15 @@ func TestVRFV2Performance(t *testing.T) {
if *cfg.ExistingEnvConfig.CreateFundSubsAndAddConsumers {
linkToken, err := env.ContractLoader.LoadLINKToken(*vrfv2Config.Performance.LinkAddress)
require.NoError(t, err)
consumers, err = vrfv2_actions.DeployVRFV2Consumers(env.ContractDeployer, coordinator.Address(), 1)
consumers, err = vrfv2.DeployVRFV2Consumers(env.ContractDeployer, coordinator.Address(), 1)
require.NoError(t, err)
err = env.EVMClient.WaitForEvents()
require.NoError(t, err, vrfv2_actions.ErrWaitTXsComplete)
require.NoError(t, err, vrfv2.ErrWaitTXsComplete)
l.Info().
Str("Coordinator", *cfg.ExistingEnvConfig.CoordinatorAddress).
Int("Number of Subs to create", *vrfv2Config.General.NumberOfSubToCreate).
Msg("Creating and funding subscriptions, deploying and adding consumers to subs")
subIDs, err = vrfv2_actions.CreateFundSubsAndAddConsumers(
subIDs, err = vrfv2.CreateFundSubsAndAddConsumers(
env,
big.NewFloat(*cfg.General.SubscriptionFundingAmountLink),
linkToken,
Expand All @@ -137,14 +137,14 @@ func TestVRFV2Performance(t *testing.T) {
err = FundNodesIfNeeded(&testConfig, env.EVMClient, l)
require.NoError(t, err)

vrfv2Contracts = &vrfv2_actions.VRFV2Contracts{
vrfv2Contracts = &vrfv2.VRFV2Contracts{
Coordinator: coordinator,
LoadTestConsumers: consumers,
BHS: nil,
}

vrfv2Data = &vrfv2_actions.VRFV2Data{
VRFV2KeyData: vrfv2_actions.VRFV2KeyData{
vrfv2Data = &vrfv2.VRFV2Data{
VRFV2KeyData: vrfv2.VRFV2KeyData{
VRFKey: nil,
EncodedProvingKey: [2]*big.Int{},
KeyHash: common.HexToHash(*vrfv2Config.Performance.KeyHash),
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestVRFV2Performance(t *testing.T) {
useVRFOwner := true
useTestCoordinator := true

vrfv2Contracts, subIDs, vrfv2Data, err = vrfv2_actions.SetupVRFV2Environment(
vrfv2Contracts, subIDs, vrfv2Data, err = vrfv2.SetupVRFV2Environment(
env,
&testConfig,
useVRFOwner,
Expand All @@ -222,7 +222,7 @@ func TestVRFV2Performance(t *testing.T) {
for _, subID := range subIDs {
subscription, err := vrfv2Contracts.Coordinator.GetSubscription(context.Background(), subID)
require.NoError(t, err, "error getting subscription information for subscription %d", subID)
vrfv2_actions.LogSubDetails(l, subscription, subID, vrfv2Contracts.Coordinator)
vrfv2.LogSubDetails(l, subscription, subID, vrfv2Contracts.Coordinator)
}

singleFeedConfig := &wasp.Config{
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestVRFV2Performance(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
//todo - timeout should be configurable depending on the perf test type
requestCount, fulfilmentCount, err := vrfv2_actions.WaitForRequestCountEqualToFulfilmentCount(consumer, 2*time.Minute, &wg)
requestCount, fulfilmentCount, err := vrfv2.WaitForRequestCountEqualToFulfilmentCount(consumer, 2*time.Minute, &wg)
require.NoError(t, err)
wg.Wait()

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/vrfv2plus/gun.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/rs/zerolog"
"github.com/smartcontractkit/wasp"

"github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2plus"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv2plus"
vrfv2plus_config "github.com/smartcontractkit/chainlink/integration-tests/testconfig/vrfv2plus"
"github.com/smartcontractkit/chainlink/integration-tests/types"
)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/vrfv2plus/vrfv2plus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/utils/conversions"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv2plus"
"github.com/smartcontractkit/chainlink/integration-tests/testreporters"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2plus"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"

Expand Down
20 changes: 10 additions & 10 deletions integration-tests/smoke/ocr2vrf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/networks"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/ocr2vrf"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/ocr2vrf/ocr2vrf_constants"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions/ocr2vrf_constants"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/config"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
Expand All @@ -34,7 +34,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) {
t.Parallel()
t.Skip("VRFv3 is on pause, skipping")
l := logging.GetTestLogger(t)
config, err := tc.GetConfig("Smoke", tc.OCR2)
testConfig, err := tc.GetConfig("Smoke", tc.OCR2)
if err != nil {
t.Fatal(err)
}
Expand All @@ -54,7 +54,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) {
require.NoError(t, err, "Retreiving on-chain wallet addresses for chainlink nodes shouldn't fail")

t.Cleanup(func() {
err := actions.TeardownSuite(t, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &config, chainClient)
err := actions.TeardownSuite(t, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &testConfig, chainClient)
require.NoError(t, err, "Error tearing down environment")
})

Expand All @@ -66,7 +66,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) {
mockETHLinkFeed, err := contractDeployer.DeployMockETHLINKFeed(ocr2vrf_constants.LinkEthFeedResponse)
require.NoError(t, err, "Error deploying Mock ETH/LINK Feed")

_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse(
_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf.SetupOCR2VRFUniverse(
t,
linkToken,
mockETHLinkFeed,
Expand All @@ -78,7 +78,7 @@ func TestOCR2VRFRedeemModel(t *testing.T) {
)

//Request and Redeem Randomness
requestID := ocr2vrf_actions.RequestAndRedeemRandomness(
requestID := ocr2vrf.RequestAndRedeemRandomness(
t,
consumerContract,
chainClient,
Expand All @@ -101,7 +101,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) {
t.Parallel()
t.Skip("VRFv3 is on pause, skipping")
l := logging.GetTestLogger(t)
config, err := tc.GetConfig("Smoke", tc.OCR2)
testConfig, err := tc.GetConfig("Smoke", tc.OCR2)
if err != nil {
t.Fatal(err)
}
Expand All @@ -121,7 +121,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) {
require.NoError(t, err, "Retreiving on-chain wallet addresses for chainlink nodes shouldn't fail")

t.Cleanup(func() {
err := actions.TeardownSuite(t, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &config, chainClient)
err := actions.TeardownSuite(t, testEnvironment, chainlinkNodes, nil, zapcore.ErrorLevel, &testConfig, chainClient)
require.NoError(t, err, "Error tearing down environment")
})

Expand All @@ -133,7 +133,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) {
mockETHLinkFeed, err := contractDeployer.DeployMockETHLINKFeed(ocr2vrf_constants.LinkEthFeedResponse)
require.NoError(t, err, "Error deploying Mock ETH/LINK Feed")

_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf_actions.SetupOCR2VRFUniverse(
_, _, vrfBeaconContract, consumerContract, subID := ocr2vrf.SetupOCR2VRFUniverse(
t,
linkToken,
mockETHLinkFeed,
Expand All @@ -144,7 +144,7 @@ func TestOCR2VRFFulfillmentModel(t *testing.T) {
testNetwork,
)

requestID := ocr2vrf_actions.RequestRandomnessFulfillmentAndWaitForFulfilment(
requestID := ocr2vrf.RequestRandomnessFulfillmentAndWaitForFulfilment(
t,
consumerContract,
chainClient,
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/vrf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrf/vrfv1"

"github.com/smartcontractkit/chainlink/integration-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv1"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
tc "github.com/smartcontractkit/chainlink/integration-tests/testconfig"
Expand Down
Loading
Loading