From 59f9ecde29949c0b2407652c59735873fd22220f Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Tue, 16 Jul 2024 13:00:28 +0400 Subject: [PATCH] changes as per review --- itests/wdpost_dispute_test.go | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/itests/wdpost_dispute_test.go b/itests/wdpost_dispute_test.go index 72bad6bf4a6..7d52a1b240f 100644 --- a/itests/wdpost_dispute_test.go +++ b/itests/wdpost_dispute_test.go @@ -10,7 +10,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-bitfield" - "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/builtin" minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner" "github.com/filecoin-project/go-state-types/crypto" @@ -286,23 +285,23 @@ func TestWindowPostDisputeFails(t *testing.T) { // Wait until a proof has been submitted. var targetDeadline uint64 - var dInfo *dline.Info waitForProof: for { - head, err := client.ChainHead(ctx) - require.NoError(t, err) - - di, err := client.StateMinerProvingDeadline(ctx, maddr, head.Key()) - require.NoError(t, err) deadlines, err := client.StateMinerDeadlines(ctx, maddr, types.EmptyTSK) require.NoError(t, err) for dlIdx, dl := range deadlines { - nonEmpty, err := dl.PostSubmissions.IsEmpty() + isEmpty, err := dl.PostSubmissions.IsEmpty() require.NoError(t, err) - if nonEmpty && di.Index == uint64(dlIdx) { + if !isEmpty { + head, err := client.ChainHead(ctx) + require.NoError(t, err) + di, err := client.StateMinerProvingDeadline(ctx, maddr, head.Key()) + require.NoError(t, err) + disputeEpoch := di.Close + 5 + _ = client.WaitTillChain(ctx, kit.HeightAtLeast(disputeEpoch)) + targetDeadline = uint64(dlIdx) - dInfo = di break waitForProof } } @@ -311,9 +310,6 @@ waitForProof: // Try to object to the proof. This should fail. { - disputeEpoch := dInfo.Close + 5 - _ = client.WaitTillChain(ctx, heightAtLeast(disputeEpoch)) - params := &minertypes.DisputeWindowedPoStParams{ Deadline: targetDeadline, PoStIndex: 0, @@ -336,12 +332,6 @@ waitForProof: } } -func heightAtLeast(target abi.ChainEpoch) func(set *types.TipSet) bool { - return func(ts *types.TipSet) bool { - return ts.Height() >= target - } -} - func submitBadProof( ctx context.Context, client api.FullNode, owner address.Address, maddr address.Address,