Skip to content

Commit

Permalink
fix test in miner
Browse files Browse the repository at this point in the history
  • Loading branch information
dshulyak committed Sep 21, 2023
1 parent 14338fe commit 5cc11d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions miner/oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func genMinerATX(tb testing.TB, cdb *datastore.CachedDB, id types.ATXID, publish
},
NumUnits: defaultNumUnits,
}}
nonce := types.VRFPostIndex(1)
atx.VRFNonce = &nonce
atx.SetID(id)
atx.SetEffectiveNumUnits(atx.NumUnits)
atx.SetReceived(received)
Expand Down Expand Up @@ -213,7 +215,10 @@ func testMinerOracleAndProposalValidator(t *testing.T, layerSize, layersPerEpoch
o.mClock.EXPECT().LayerToTime(gomock.Any()).Return(epochStart).AnyTimes()
received := epochStart.Add(-5 * networkDelay)
epochInfo := genATXForTargetEpochs(t, o.cdb, types.EpochID(startEpoch), types.EpochID(startEpoch+numberOfEpochsToTest), o.edSigner, layersPerEpoch, received)
require.NoError(t, cache.Warmup(o.cdb.Database, c), "should load generated state")
tx, err := o.cdb.Tx(context.TODO())
require.NoError(t, err)
require.NoError(t, cache.Warmup(tx, c), "should load generated state")
tx.Release()
for layer := types.LayerID(startLayer); layer.Before(endLayer); layer = layer.Add(1) {
info, ok := epochInfo[layer.GetEpoch()]
require.True(t, ok)
Expand All @@ -226,7 +231,6 @@ func testMinerOracleAndProposalValidator(t *testing.T, layerSize, layersPerEpoch
b.SmesherID = o.edSigner.NodeID()
o.mClock.EXPECT().CurrentLayer().Return(layer)
mbc.EXPECT().ReportBeaconFromBallot(layer.GetEpoch(), b, info.beacon, gomock.Any()).Times(1)
nonceFetcher.EXPECT().VRFNonce(b.SmesherID, layer.GetEpoch()).Return(nonce, nil).Times(1)
eligible, err := validator.CheckEligibility(context.Background(), b, ee.ActiveSet)
require.NoError(t, err, "at layer %d, with layersPerEpoch %d", layer, layersPerEpoch)
require.True(t, eligible, "should be eligible at layer %d, but isn't", layer)
Expand Down

0 comments on commit 5cc11d6

Please sign in to comment.