feat: test disputing nv20 window posts fails

This commit is contained in:
Aayush 2023-04-23 09:44:31 -04:00
parent 0d8659e76f
commit 4430a138b6

View File

@ -8,6 +8,9 @@ import (
"testing"
"time"
"github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-address"
@ -484,4 +487,40 @@ waitForProof:
// Simulate call on inclTs's parents, so that the partition isn't already proven
_, err = client.StateCall(ctx, slmsg, inclTs.Parents())
require.ErrorContains(t, err, "expected proof of type StackedDRGWindow2KiBV1P1, got StackedDRGWindow2KiBV1")
for {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err)
// wait until the deadline finishes.
if di.Index == ((params.Deadline + 1) % di.WPoStPeriodDeadlines) {
break
}
build.Clock.Sleep(blocktime)
}
// Try to object to the proof. This should fail.
disputeParams := &miner11.DisputeWindowedPoStParams{
Deadline: params.Deadline,
PoStIndex: 0,
}
enc, aerr := actors.SerializeParams(disputeParams)
require.NoError(t, aerr)
disputeMsg := &types.Message{
To: maddr,
Method: builtin.MethodsMiner.DisputeWindowedPoSt,
Params: enc,
Value: types.NewInt(0),
From: client.DefaultKey.Address,
}
_, err = client.MpoolPushMessage(ctx, disputeMsg, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "failed to dispute valid post")
require.Contains(t, err.Error(), "(RetCode=16)")
}