2021-12-10 10:33:29 +00:00
|
|
|
//stm: #integration
|
2021-05-18 20:32:10 +00:00
|
|
|
package itests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2021-06-17 09:57:16 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/big"
|
2021-08-06 00:46:05 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/network"
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
"github.com/filecoin-project/lotus/api"
|
2021-05-18 20:32:10 +00:00
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2021-06-18 18:45:29 +00:00
|
|
|
"github.com/filecoin-project/lotus/itests/kit"
|
2021-05-18 20:32:10 +00:00
|
|
|
"github.com/filecoin-project/lotus/node/impl"
|
2022-06-14 18:03:38 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/sealer/mock"
|
2022-06-17 11:31:05 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
2021-05-18 20:32:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestWindowedPost(t *testing.T) {
|
2021-12-13 12:41:04 +00:00
|
|
|
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001,
|
|
|
|
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01
|
|
|
|
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
|
|
|
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
2021-12-14 10:33:33 +00:00
|
|
|
|
|
|
|
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
|
2021-06-23 15:37:43 +00:00
|
|
|
kit.Expensive(t)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
kit.QuietMiningLogs()
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
blocktime = 2 * time.Millisecond
|
|
|
|
nSectors = 10
|
|
|
|
)
|
|
|
|
|
|
|
|
for _, height := range []abi.ChainEpoch{
|
|
|
|
-1, // before
|
|
|
|
162, // while sealing
|
|
|
|
5000, // while proving
|
|
|
|
} {
|
|
|
|
height := height // copy to satisfy lints
|
|
|
|
t.Run(fmt.Sprintf("upgrade-%d", height), func(t *testing.T) {
|
2021-06-17 09:57:16 +00:00
|
|
|
testWindowPostUpgrade(t, blocktime, nSectors, height)
|
2021-05-18 20:32:10 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, upgradeHeight abi.ChainEpoch) {
|
2021-05-18 20:32:10 +00:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
2021-08-06 00:46:05 +00:00
|
|
|
client, miner, ens := kit.EnsembleMinimal(t,
|
|
|
|
kit.MockProofs(),
|
|
|
|
kit.LatestActorsAt(upgradeHeight))
|
2021-06-17 09:57:16 +00:00
|
|
|
ens.InterconnectAll().BeginMining(blocktime)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
miner.PledgeSectors(ctx, nSectors, 0, nil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
maddr, err := miner.ActorAddress(ctx)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
2021-05-18 20:32:10 +00:00
|
|
|
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
mid, err := address.IDFromAddress(maddr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Log("Running one proving period")
|
2021-08-06 00:46:05 +00:00
|
|
|
waitUntil := di.Open + di.WPoStProvingPeriod
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Logf("End for head.Height > %d", waitUntil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
2021-06-18 09:27:20 +00:00
|
|
|
t.Logf("Now head.Height = %d", ts.Height())
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_POWER_001
|
2021-05-18 20:32:10 +00:00
|
|
|
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
ssz, err := miner.ActorSectorSize(ctx, maddr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.Equal(t, p.MinerPower, p.TotalPower)
|
2021-06-18 18:45:29 +00:00
|
|
|
require.Equal(t, p.MinerPower.RawBytePower, types.NewInt(uint64(ssz)*uint64(nSectors+kit.DefaultPresealsPerBootstrapMiner)))
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Log("Drop some sectors")
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
// Drop 2 sectors from deadline 2 partition 0 (full partition / deadline)
|
|
|
|
{
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
|
2021-05-18 20:32:10 +00:00
|
|
|
parts, err := client.StateMinerPartitions(ctx, maddr, 2, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Greater(t, len(parts), 0)
|
|
|
|
|
|
|
|
secs := parts[0].AllSectors
|
|
|
|
n, err := secs.Count()
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, uint64(2), n)
|
|
|
|
|
|
|
|
// Drop the partition
|
|
|
|
err = secs.ForEach(func(sid uint64) error {
|
2022-06-17 11:31:05 +00:00
|
|
|
return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(storiface.SectorRef{
|
2021-05-18 20:32:10 +00:00
|
|
|
ID: abi.SectorID{
|
|
|
|
Miner: abi.ActorID(mid),
|
|
|
|
Number: abi.SectorNumber(sid),
|
|
|
|
},
|
|
|
|
}, true)
|
|
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
2022-06-17 11:31:05 +00:00
|
|
|
var s storiface.SectorRef
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
// Drop 1 sectors from deadline 3 partition 0
|
|
|
|
{
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
|
2021-05-18 20:32:10 +00:00
|
|
|
parts, err := client.StateMinerPartitions(ctx, maddr, 3, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Greater(t, len(parts), 0)
|
|
|
|
|
|
|
|
secs := parts[0].AllSectors
|
|
|
|
n, err := secs.Count()
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, uint64(2), n)
|
|
|
|
|
|
|
|
// Drop the sector
|
|
|
|
sn, err := secs.First()
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
all, err := secs.All(2)
|
|
|
|
require.NoError(t, err)
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Log("the sectors", all)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2022-06-17 11:31:05 +00:00
|
|
|
s = storiface.SectorRef{
|
2021-05-18 20:32:10 +00:00
|
|
|
ID: abi.SectorID{
|
|
|
|
Miner: abi.ActorID(mid),
|
|
|
|
Number: abi.SectorNumber(sn),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
err = miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkFailed(s, true)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
2021-05-18 20:32:10 +00:00
|
|
|
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Log("Go through another PP, wait for sectors to become faulty")
|
2021-08-06 00:46:05 +00:00
|
|
|
waitUntil = di.Open + di.WPoStProvingPeriod
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Logf("End for head.Height > %d", waitUntil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
2021-06-18 15:19:58 +00:00
|
|
|
t.Logf("Now head.Height = %d", ts.Height())
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_POWER_001
|
2021-05-18 20:32:10 +00:00
|
|
|
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.Equal(t, p.MinerPower, p.TotalPower)
|
|
|
|
|
|
|
|
sectors := p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
|
2021-06-18 18:45:29 +00:00
|
|
|
require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-3, int(sectors)) // -3 just removed sectors
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Log("Recover one sector")
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
err = miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkFailed(s, false)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
2021-05-18 20:32:10 +00:00
|
|
|
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-08-06 00:46:05 +00:00
|
|
|
waitUntil = di.Open + di.WPoStProvingPeriod
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Logf("End for head.Height > %d", waitUntil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
2021-06-18 15:19:58 +00:00
|
|
|
t.Logf("Now head.Height = %d", ts.Height())
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_POWER_001
|
2021-05-18 20:32:10 +00:00
|
|
|
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.Equal(t, p.MinerPower, p.TotalPower)
|
|
|
|
|
|
|
|
sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
|
2021-06-18 18:45:29 +00:00
|
|
|
require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-2, int(sectors)) // -2 not recovered sectors
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
// pledge a sector after recovery
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
miner.PledgeSectors(ctx, 1, nSectors, nil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
// Wait until proven.
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
2021-05-18 20:32:10 +00:00
|
|
|
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-08-06 00:46:05 +00:00
|
|
|
waitUntil := di.Open + di.WPoStProvingPeriod
|
2021-06-17 09:57:16 +00:00
|
|
|
t.Logf("End for head.Height > %d\n", waitUntil)
|
2021-05-18 20:32:10 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
2021-06-18 15:19:58 +00:00
|
|
|
t.Logf("Now head.Height = %d", ts.Height())
|
2021-05-18 20:32:10 +00:00
|
|
|
}
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_POWER_001
|
2021-05-18 20:32:10 +00:00
|
|
|
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.Equal(t, p.MinerPower, p.TotalPower)
|
|
|
|
|
|
|
|
sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
|
2021-06-18 18:45:29 +00:00
|
|
|
require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-2+1, int(sectors)) // -2 not recovered sectors + 1 just pledged
|
2021-05-18 20:32:10 +00:00
|
|
|
}
|
2021-06-07 22:17:44 +00:00
|
|
|
|
|
|
|
func TestWindowPostBaseFeeNoBurn(t *testing.T) {
|
2021-12-13 12:41:04 +00:00
|
|
|
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001,
|
|
|
|
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01
|
|
|
|
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
|
|
|
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
2021-12-14 10:33:33 +00:00
|
|
|
|
|
|
|
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
|
2021-06-23 15:37:43 +00:00
|
|
|
kit.Expensive(t)
|
2021-06-07 22:17:44 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
kit.QuietMiningLogs()
|
2021-06-07 22:17:44 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
blocktime = 2 * time.Millisecond
|
|
|
|
nSectors = 10
|
|
|
|
)
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
och := build.UpgradeClausHeight
|
2021-08-06 00:46:05 +00:00
|
|
|
build.UpgradeClausHeight = 0
|
|
|
|
t.Cleanup(func() { build.UpgradeClausHeight = och })
|
2021-06-07 22:17:44 +00:00
|
|
|
|
2021-08-06 00:46:05 +00:00
|
|
|
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.GenesisNetworkVersion(network.Version9))
|
2021-06-17 09:57:16 +00:00
|
|
|
ens.InterconnectAll().BeginMining(blocktime)
|
2021-06-07 22:17:44 +00:00
|
|
|
|
|
|
|
maddr, err := miner.ActorAddress(ctx)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_INFO_001
|
2021-06-07 22:17:44 +00:00
|
|
|
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
miner.PledgeSectors(ctx, nSectors, 0, nil)
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_GET_ACTOR_001
|
2021-06-07 22:17:44 +00:00
|
|
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
en := wact.Nonce
|
|
|
|
|
|
|
|
// wait for a new message to be sent from worker address, it will be a PoSt
|
|
|
|
|
|
|
|
waitForProof:
|
|
|
|
for {
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_GET_ACTOR_001
|
2021-06-07 22:17:44 +00:00
|
|
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
if wact.Nonce > en {
|
|
|
|
break waitForProof
|
|
|
|
}
|
|
|
|
|
|
|
|
build.Clock.Sleep(blocktime)
|
|
|
|
}
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_LIST_MESSAGES_001
|
2021-06-07 22:17:44 +00:00
|
|
|
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_REPLAY_001
|
2021-06-07 22:17:44 +00:00
|
|
|
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.Equal(t, pmr.GasCost.BaseFeeBurn, big.Zero())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestWindowPostBaseFeeBurn(t *testing.T) {
|
2021-12-13 12:41:04 +00:00
|
|
|
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001,
|
|
|
|
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01
|
|
|
|
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
|
|
|
|
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
|
2021-12-14 10:33:33 +00:00
|
|
|
|
|
|
|
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
|
2021-06-23 15:37:43 +00:00
|
|
|
kit.Expensive(t)
|
2021-06-07 22:17:44 +00:00
|
|
|
|
2021-06-18 18:45:29 +00:00
|
|
|
kit.QuietMiningLogs()
|
2021-06-07 22:17:44 +00:00
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
blocktime := 2 * time.Millisecond
|
|
|
|
|
2021-08-06 00:46:05 +00:00
|
|
|
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
|
2021-06-17 09:57:16 +00:00
|
|
|
ens.InterconnectAll().BeginMining(blocktime)
|
2021-06-07 22:17:44 +00:00
|
|
|
|
|
|
|
maddr, err := miner.ActorAddress(ctx)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_MINER_INFO_001
|
2021-06-07 22:17:44 +00:00
|
|
|
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-06-17 09:57:16 +00:00
|
|
|
miner.PledgeSectors(ctx, 10, 0, nil)
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_GET_ACTOR_001
|
2021-06-07 22:17:44 +00:00
|
|
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
en := wact.Nonce
|
|
|
|
|
|
|
|
// wait for a new message to be sent from worker address, it will be a PoSt
|
|
|
|
|
|
|
|
waitForProof:
|
|
|
|
for {
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_GET_ACTOR_001
|
2021-06-07 22:17:44 +00:00
|
|
|
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
|
|
|
require.NoError(t, err)
|
|
|
|
if wact.Nonce > en {
|
|
|
|
break waitForProof
|
|
|
|
}
|
|
|
|
|
|
|
|
build.Clock.Sleep(blocktime)
|
|
|
|
}
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_LIST_MESSAGES_001
|
2021-06-07 22:17:44 +00:00
|
|
|
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2021-12-10 15:08:25 +00:00
|
|
|
//stm: @CHAIN_STATE_REPLAY_001
|
2021-06-07 22:17:44 +00:00
|
|
|
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
require.NotEqual(t, pmr.GasCost.BaseFeeBurn, big.Zero())
|
|
|
|
}
|