Skip to content

Commit

Permalink
[VRF-616] Fix test flake for trusted BHS (#10728)
Browse files Browse the repository at this point in the history
* [VRF-616] Fix test flake for trusted BHS

* Modulate waitblocks on trusted bhs added delay test

* fix merge conflict
  • Loading branch information
vreff authored Sep 28, 2023
1 parent f684afc commit 17772f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/services/vrf/v1/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestIntegration_VRF_WithBHS(t *testing.T) {

// Create BHS Job and start it
bhsJob := vrftesthelpers.CreateAndStartBHSJob(t, sendingKeys, app, cu.BHSContractAddress.String(),
cu.RootContractAddress.String(), "", "", "", 0, 200, 0)
cu.RootContractAddress.String(), "", "", "", 0, 200, 0, 100)

// Ensure log poller is ready and has all logs.
require.NoError(t, app.GetRelayers().LegacyEVMChains().Slice()[0].LogPoller().Ready())
Expand Down
2 changes: 1 addition & 1 deletion core/services/vrf/v2/bhs_feeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestStartHeartbeats(t *testing.T) {

_ = vrftesthelpers.CreateAndStartBHSJob(
t, bhsKeyAddresses, app, uni.bhsContractAddress.String(), "",
v2CoordinatorAddress, v2PlusCoordinatorAddress, "", 0, 200, heartbeatPeriod)
v2CoordinatorAddress, v2PlusCoordinatorAddress, "", 0, 200, heartbeatPeriod, 100)

// Ensure log poller is ready and has all logs.
require.NoError(t, app.GetRelayers().LegacyEVMChains().Slice()[0].LogPoller().Ready())
Expand Down
9 changes: 7 additions & 2 deletions core/services/vrf/v2/integration_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func testMultipleConsumersNeedBHS(

_ = vrftesthelpers.CreateAndStartBHSJob(
t, bhsKeyAddresses, app, uni.bhsContractAddress.String(), "",
v2CoordinatorAddress, v2PlusCoordinatorAddress, "", 0, 200, 0)
v2CoordinatorAddress, v2PlusCoordinatorAddress, "", 0, 200, 0, 100)

// Ensure log poller is ready and has all logs.
require.NoError(t, app.GetRelayers().LegacyEVMChains().Slice()[0].LogPoller().Ready())
Expand Down Expand Up @@ -350,6 +350,7 @@ func testMultipleConsumersNeedTrustedBHS(
config, db := heavyweight.FullTestDBV2(t, "vrfv2_needs_trusted_blockhash_store", func(c *chainlink.Config, s *chainlink.Secrets) {
simulatedOverrides(t, assets.GWei(10), keySpecificOverrides...)(c, s)
c.EVM[0].MinIncomingConfirmations = ptr[uint32](2)
c.EVM[0].GasEstimator.LimitDefault = ptr(uint32(5_000_000))
c.Feature.LogPoller = ptr(true)
c.EVM[0].FinalityDepth = ptr[uint32](2)
c.EVM[0].LogPollInterval = models.MustNewDuration(time.Second)
Expand Down Expand Up @@ -384,9 +385,13 @@ func testMultipleConsumersNeedTrustedBHS(
v2PlusCoordinatorAddress = coordinatorAddress.String()
}

waitBlocks := 100
if addedDelay {
waitBlocks = 400
}
_ = vrftesthelpers.CreateAndStartBHSJob(
t, bhsKeyAddressesStrings, app, "", "",
v2CoordinatorAddress, v2PlusCoordinatorAddress, uni.trustedBhsContractAddress.String(), 20, 1000, 0)
v2CoordinatorAddress, v2PlusCoordinatorAddress, uni.trustedBhsContractAddress.String(), 20, 1000, 0, waitBlocks)

// Ensure log poller is ready and has all logs.
chain := app.GetRelayers().LegacyEVMChains().Slice()[0]
Expand Down
1 change: 0 additions & 1 deletion core/services/vrf/v2/integration_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,6 @@ func TestVRFV2Integration_SingleConsumer_NeedsTrustedBlockhashStore(t *testing.T
}

func TestVRFV2Integration_SingleConsumer_NeedsTrustedBlockhashStore_AfterDelay(t *testing.T) {
t.Skip("TODO: VRF-616")
t.Parallel()
ownerKey := cltest.MustGenerateRandomKey(t)
uni := newVRFCoordinatorV2PlusUniverse(t, ownerKey, 2, true)
Expand Down
4 changes: 2 additions & 2 deletions core/services/vrf/vrftesthelpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func CreateAndStartBHSJob(
app *cltest.TestApplication,
bhsAddress, coordinatorV1Address, coordinatorV2Address, coordinatorV2PlusAddress string,
trustedBlockhashStoreAddress string, trustedBlockhashStoreBatchSize int32, lookback int,
heartbeatPeriod time.Duration,
heartbeatPeriod time.Duration, waitBlocks int,
) job.Job {
jid := uuid.New()
s := testspecs.GenerateBlockhashStoreSpec(testspecs.BlockhashStoreSpecParams{
Expand All @@ -60,7 +60,7 @@ func CreateAndStartBHSJob(
CoordinatorV1Address: coordinatorV1Address,
CoordinatorV2Address: coordinatorV2Address,
CoordinatorV2PlusAddress: coordinatorV2PlusAddress,
WaitBlocks: 100,
WaitBlocks: waitBlocks,
LookbackBlocks: lookback,
HeartbeatPeriod: heartbeatPeriod,
BlockhashStoreAddress: bhsAddress,
Expand Down

0 comments on commit 17772f3

Please sign in to comment.