Annotate state feature tests

This commit is contained in:
Darko Brdareski 2021-12-10 16:08:25 +01:00
parent f04bae3f0b
commit 0169d0dafd
20 changed files with 91 additions and 0 deletions

View File

@ -717,6 +717,7 @@ func TestDuplicateNonce(t *testing.T) {
var includedMsg cid.Cid var includedMsg cid.Cid
var skippedMsg cid.Cid var skippedMsg cid.Cid
//stm: @CHAIN_STATE_SEARCH_MSG_001
r0, err0 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[0][0].Cid(), api.LookbackNoLimit, true) r0, err0 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[0][0].Cid(), api.LookbackNoLimit, true)
r1, err1 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[1][0].Cid(), api.LookbackNoLimit, true) r1, err1 := tu.nds[0].StateSearchMsg(context.TODO(), ts2.TipSet().Key(), msgs[1][0].Cid(), api.LookbackNoLimit, true)
@ -823,6 +824,7 @@ func TestMismatchedNoncesRobustID(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// Produce a message from the banker // Produce a message from the banker
//stm: @CHAIN_STATE_LOOKUP_ID_001
makeMsg := func(id bool) *types.SignedMessage { makeMsg := func(id bool) *types.SignedMessage {
sender := tu.g.Banker() sender := tu.g.Banker()
if id { if id {
@ -880,6 +882,7 @@ func TestMatchedNoncesRobustID(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// Produce a message from the banker with specified nonce // Produce a message from the banker with specified nonce
//stm: @CHAIN_STATE_LOOKUP_ID_001
makeMsg := func(n uint64, id bool) *types.SignedMessage { makeMsg := func(n uint64, id bool) *types.SignedMessage {
sender := tu.g.Banker() sender := tu.g.Banker()
if id { if id {

View File

@ -1,3 +1,4 @@
//stm: #unit
package sealing_test package sealing_test
import ( import (
@ -28,6 +29,7 @@ import (
) )
func TestCommitBatcher(t *testing.T) { func TestCommitBatcher(t *testing.T) {
//stm: @CHAIN_STATE_MINER_PRE_COM_INFO_001, @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
t0123, err := address.NewFromString("t0123") t0123, err := address.NewFromString("t0123")
require.NoError(t, err) require.NoError(t, err)
@ -147,6 +149,7 @@ func TestCommitBatcher(t *testing.T) {
} }
} }
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001, @CHAIN_STATE_MINER_GET_COLLATERAL_001
expectSend := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action { expectSend := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action {
return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise {
s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(miner.MinerInfo{Owner: t0123, Worker: t0123}, nil) s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(miner.MinerInfo{Owner: t0123, Worker: t0123}, nil)

View File

@ -1,3 +1,4 @@
//stm: #unit
package sealing_test package sealing_test
import ( import (
@ -38,6 +39,7 @@ var fc = config.MinerFeeConfig{
} }
func TestPrecommitBatcher(t *testing.T) { func TestPrecommitBatcher(t *testing.T) {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
t0123, err := address.NewFromString("t0123") t0123, err := address.NewFromString("t0123")
require.NoError(t, err) require.NoError(t, err)
@ -151,6 +153,7 @@ func TestPrecommitBatcher(t *testing.T) {
} }
} }
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSend := func(expect []abi.SectorNumber) action { expectSend := func(expect []abi.SectorNumber) action {
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil) s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
@ -171,6 +174,7 @@ func TestPrecommitBatcher(t *testing.T) {
} }
} }
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSendsSingle := func(expect []abi.SectorNumber) action { expectSendsSingle := func(expect []abi.SectorNumber) action {
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil) s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)

View File

@ -1,3 +1,4 @@
//stm: #unit
package sealing_test package sealing_test
import ( import (
@ -47,6 +48,7 @@ func TestStateRecoverDealIDs(t *testing.T) {
PieceCID: idCid("newPieceCID"), PieceCID: idCid("newPieceCID"),
} }
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001, @CHAIN_STATE_NETWORK_VERSION_001
api.EXPECT().StateMarketStorageDealProposal(ctx, dealId, nil).Return(dealProposal, nil) api.EXPECT().StateMarketStorageDealProposal(ctx, dealId, nil).Return(dealProposal, nil)
pc := idCid("publishCID") pc := idCid("publishCID")

View File

@ -24,6 +24,8 @@ func TestAPI(t *testing.T) {
//stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01 //stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01
//stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001 //stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001 //stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001
//stm: @CHAIN_STATE_MINER_INFO_001
t.Run("direct", func(t *testing.T) { t.Run("direct", func(t *testing.T) {
runAPITest(t) runAPITest(t)
}) })
@ -121,11 +123,13 @@ func (ts *apiSuite) testSearchMsg(t *testing.T) {
sm, err := full.MpoolPushMessage(ctx, msg, nil) sm, err := full.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err := full.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true) res, err := full.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, exitcode.Ok, res.Receipt.ExitCode, "message not successful") require.Equal(t, exitcode.Ok, res.Receipt.ExitCode, "message not successful")
//stm: @CHAIN_STATE_SEARCH_MSG_001
searchRes, err := full.StateSearchMsg(ctx, types.EmptyTSK, sm.Cid(), lapi.LookbackNoLimit, true) searchRes, err := full.StateSearchMsg(ctx, types.EmptyTSK, sm.Cid(), lapi.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, searchRes) require.NotNil(t, searchRes)

View File

@ -19,6 +19,8 @@ func TestCCUpgrade(t *testing.T) {
//stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01 //stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01
//stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001 //stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001 //stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001
//stm: @CHAIN_STATE_MINER_GET_INFO_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
for _, height := range []abi.ChainEpoch{ for _, height := range []abi.ChainEpoch{
@ -90,6 +92,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
require.Less(t, 50000, int(exp.OnTime)) require.Less(t, 50000, int(exp.OnTime))
} }
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
dlInfo, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) dlInfo, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)

View File

@ -113,6 +113,7 @@ func TestDeadlineToggling(t *testing.T) {
{ {
minerC.PledgeSectors(ctx, sectorsC, 0, nil) minerC.PledgeSectors(ctx, sectorsC, 0, nil)
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddrC, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddrC, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -132,6 +133,7 @@ func TestDeadlineToggling(t *testing.T) {
expectedPower := types.NewInt(uint64(ssz) * sectorsC) expectedPower := types.NewInt(uint64(ssz) * sectorsC)
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, maddrC, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddrC, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -152,12 +154,14 @@ func TestDeadlineToggling(t *testing.T) {
} }
checkMiner := func(ma address.Address, power abi.StoragePower, active, activeIfCron bool, tsk types.TipSetKey) { checkMiner := func(ma address.Address, power abi.StoragePower, active, activeIfCron bool, tsk types.TipSetKey) {
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, ma, tsk) p, err := client.StateMinerPower(ctx, ma, tsk)
require.NoError(t, err) require.NoError(t, err)
// make sure it has the expected power. // make sure it has the expected power.
require.Equal(t, p.MinerPower.RawBytePower, power) require.Equal(t, p.MinerPower.RawBytePower, power)
//stm: @CHAIN_STATE_GET_ACTOR_001
mact, err := client.StateGetActor(ctx, ma, tsk) mact, err := client.StateGetActor(ctx, ma, tsk)
require.NoError(t, err) require.NoError(t, err)
@ -192,6 +196,7 @@ func TestDeadlineToggling(t *testing.T) {
checkMiner(maddrB, types.NewInt(0), true, true, uts.Key()) checkMiner(maddrB, types.NewInt(0), true, true, uts.Key())
} }
//stm: @CHAIN_STATE_NETWORK_VERSION_001
nv, err := client.StateNetworkVersion(ctx, types.EmptyTSK) nv, err := client.StateNetworkVersion(ctx, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.GreaterOrEqual(t, nv, network.Version12) require.GreaterOrEqual(t, nv, network.Version12)
@ -251,6 +256,7 @@ func TestDeadlineToggling(t *testing.T) {
}, nil) }, nil)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
r, err := client.StateWaitMsg(ctx, m.Cid(), 2, api.LookbackNoLimit, true) r, err := client.StateWaitMsg(ctx, m.Cid(), 2, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode) require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)
@ -303,6 +309,7 @@ func TestDeadlineToggling(t *testing.T) {
sectorbit := bitfield.New() sectorbit := bitfield.New()
sectorbit.Set(uint64(sectorNum)) sectorbit.Set(uint64(sectorNum))
//stm: @CHAIN_STATE_SECTOR_PARTITION_001
loca, err := client.StateSectorPartition(ctx, maddrD, sectorNum, types.EmptyTSK) loca, err := client.StateSectorPartition(ctx, maddrD, sectorNum, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -334,6 +341,7 @@ func TestDeadlineToggling(t *testing.T) {
t.Log("sent termination message:", smsg.Cid()) t.Log("sent termination message:", smsg.Cid())
//stm: @CHAIN_STATE_WAIT_MSG_001
r, err := client.StateWaitMsg(ctx, smsg.Cid(), 2, api.LookbackNoLimit, true) r, err := client.StateWaitMsg(ctx, smsg.Cid(), 2, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode) require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)

View File

@ -108,6 +108,7 @@ func TestPublishDealsBatching(t *testing.T) {
} }
// Expect a single PublishStorageDeals message that includes the first two deals // Expect a single PublishStorageDeals message that includes the first two deals
//stm: @CHAIN_STATE_LIST_MESSAGES_001
msgCids, err := client.StateListMessages(ctx, &api.MessageMatch{To: market.Address}, types.EmptyTSK, 1) msgCids, err := client.StateListMessages(ctx, &api.MessageMatch{To: market.Address}, types.EmptyTSK, 1)
require.NoError(t, err) require.NoError(t, err)
count := 0 count := 0

View File

@ -121,6 +121,7 @@ func TestGatewayWalletMsig(t *testing.T) {
addProposal, err := doSend(proto) addProposal, err := doSend(proto)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err := lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true) res, err := lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
@ -132,6 +133,7 @@ func TestGatewayWalletMsig(t *testing.T) {
// Get available balance of msig: should be greater than zero and less // Get available balance of msig: should be greater than zero and less
// than initial amount // than initial amount
msig := execReturn.IDAddress msig := execReturn.IDAddress
//stm: @CHAIN_STATE_MINER_AVAILABLE_BALANCE_001
msigBalance, err := lite.MsigGetAvailableBalance(ctx, msig, types.EmptyTSK) msigBalance, err := lite.MsigGetAvailableBalance(ctx, msig, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Greater(t, msigBalance.Int64(), int64(0)) require.Greater(t, msigBalance.Int64(), int64(0))
@ -144,6 +146,7 @@ func TestGatewayWalletMsig(t *testing.T) {
addProposal, err = doSend(proto) addProposal, err = doSend(proto)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err = lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true) res, err = lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
@ -161,6 +164,7 @@ func TestGatewayWalletMsig(t *testing.T) {
approval1, err := doSend(proto) approval1, err := doSend(proto)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err = lite.StateWaitMsg(ctx, approval1, 1, api.LookbackNoLimit, true) res, err = lite.StateWaitMsg(ctx, approval1, 1, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)

View File

@ -89,6 +89,7 @@ func TestChainGetMessagesInTs(t *testing.T) {
} }
for _, sm := range sms { for _, sm := range sms {
//stm: @CHAIN_STATE_WAIT_MSG_001
msgLookup, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true) msgLookup, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)

View File

@ -56,6 +56,7 @@ func TestNonceIncremental(t *testing.T) {
} }
for _, sm := range sms { for _, sm := range sms {
//stm: @CHAIN_STATE_WAIT_MSG_001
_, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true) _, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
} }

View File

@ -112,6 +112,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
preds := state.NewStatePredicates(paymentCreator) preds := state.NewStatePredicates(paymentCreator)
finished := make(chan struct{}) finished := make(chan struct{})
//stm: @CHAIN_STATE_GET_ACTOR_001
err = ev.StateChanged(func(ctx context.Context, ts *types.TipSet) (done bool, more bool, err error) { err = ev.StateChanged(func(ctx context.Context, ts *types.TipSet) (done bool, more bool, err error) {
act, err := paymentCreator.StateGetActor(ctx, channel, ts.Key()) act, err := paymentCreator.StateGetActor(ctx, channel, ts.Key())
if err != nil { if err != nil {
@ -187,6 +188,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
collectMsg, err := paymentReceiver.PaychCollect(ctx, channel) collectMsg, err := paymentReceiver.PaychCollect(ctx, channel)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err = paymentReceiver.StateWaitMsg(ctx, collectMsg, 3, api.LookbackNoLimit, true) res, err = paymentReceiver.StateWaitMsg(ctx, collectMsg, 3, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode, "unable to collect on payment channel") require.EqualValues(t, 0, res.Receipt.ExitCode, "unable to collect on payment channel")

View File

@ -22,6 +22,7 @@ func TestSDRUpgrade(t *testing.T) {
//stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01 //stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01
//stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001 //stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001 //stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001
//stm: @CHAIN_STATE_NETWORK_VERSION_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
// oldDelay := policy.GetPreCommitChallengeDelay() // oldDelay := policy.GetPreCommitChallengeDelay()

View File

@ -182,6 +182,7 @@ func TestPledgeMaxBatching(t *testing.T) {
} }
// Ensure that max aggregate message has propagated to the other node by checking current state // Ensure that max aggregate message has propagated to the other node by checking current state
//stm: @CHAIN_STATE_MINER_SECTORS_001
sectorInfosAfter, err := full.StateMinerSectors(ctx, miner.ActorAddr, nil, types.EmptyTSK) sectorInfosAfter, err := full.StateMinerSectors(ctx, miner.ActorAddr, nil, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, miner5.MaxAggregatedSectors+kit.DefaultPresealsPerBootstrapMiner, len(sectorInfosAfter)) assert.Equal(t, miner5.MaxAggregatedSectors+kit.DefaultPresealsPerBootstrapMiner, len(sectorInfosAfter))

View File

@ -38,6 +38,7 @@ func TestTerminate(t *testing.T) {
ssz, err := miner.ActorSectorSize(ctx, maddr) ssz, err := miner.ActorSectorSize(ctx, maddr)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
@ -50,6 +51,7 @@ func TestTerminate(t *testing.T) {
t.Log("wait for power") t.Log("wait for power")
{ {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
// Wait until proven. // Wait until proven.
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -63,6 +65,7 @@ func TestTerminate(t *testing.T) {
nSectors++ nSectors++
//stm: @CHAIN_STATE_MINER_POWER_001
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
@ -116,6 +119,7 @@ loop:
// need to wait for message to be mined and applied. // need to wait for message to be mined and applied.
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
//stm: @CHAIN_STATE_MINER_POWER_001
// check power decreased // check power decreased
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -124,6 +128,7 @@ loop:
// check in terminated set // check in terminated set
{ {
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
parts, err := client.StateMinerPartitions(ctx, maddr, 1, types.EmptyTSK) parts, err := client.StateMinerPartitions(ctx, maddr, 1, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Greater(t, len(parts), 0) require.Greater(t, len(parts), 0)
@ -138,6 +143,7 @@ loop:
require.Equal(t, uint64(0), bflen(parts[0].LiveSectors)) require.Equal(t, uint64(0), bflen(parts[0].LiveSectors))
} }
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -146,6 +152,7 @@ loop:
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
//stm: @CHAIN_STATE_MINER_POWER_001
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)

View File

@ -56,6 +56,7 @@ func TestVerifiedClientTopUp(t *testing.T) {
defer cancel() defer cancel()
// get VRH // get VRH
//stm: @CHAIN_STATE_VERIFIED_REGISTRY_ROOT_KEY_001
vrh, err := api.StateVerifiedRegistryRootKey(ctx, types.TipSetKey{}) vrh, err := api.StateVerifiedRegistryRootKey(ctx, types.TipSetKey{})
fmt.Println(vrh.String()) fmt.Println(vrh.String())
require.NoError(t, err) require.NoError(t, err)
@ -86,6 +87,7 @@ func TestVerifiedClientTopUp(t *testing.T) {
sm, err := api.MpoolPushMessage(ctx, msg, nil) sm, err := api.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err, "AddVerifier failed") require.NoError(t, err, "AddVerifier failed")
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err := api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true) res, err := api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
@ -107,11 +109,13 @@ func TestVerifiedClientTopUp(t *testing.T) {
sm, err = api.MpoolPushMessage(ctx, msg, nil) sm, err = api.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
res, err = api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true) res, err = api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
// check datacap balance // check datacap balance
//stm: @CHAIN_STATE_VERIFIED_CLIENT_STATUS_001
dcap, err := api.StateVerifiedClientStatus(ctx, verifiedClientAddr, types.EmptyTSK) dcap, err := api.StateVerifiedClientStatus(ctx, verifiedClientAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)

View File

@ -66,6 +66,7 @@ func TestWindowPostDispute(t *testing.T) {
evilMinerAddr, err := evilMiner.ActorAddress(ctx) evilMinerAddr, err := evilMiner.ActorAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -77,6 +78,7 @@ func TestWindowPostDispute(t *testing.T) {
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -89,6 +91,7 @@ func TestWindowPostDispute(t *testing.T) {
evilSectors, err := evilMiner.SectorsList(ctx) evilSectors, err := evilMiner.SectorsList(ctx)
require.NoError(t, err) require.NoError(t, err)
evilSectorNo := evilSectors[0] // only one. evilSectorNo := evilSectors[0] // only one.
//stm: @CHAIN_STATE_SECTOR_PARTITION_001
evilSectorLoc, err := client.StateSectorPartition(ctx, evilMinerAddr, evilSectorNo, types.EmptyTSK) evilSectorLoc, err := client.StateSectorPartition(ctx, evilMinerAddr, evilSectorNo, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -101,6 +104,7 @@ func TestWindowPostDispute(t *testing.T) {
// Wait until we need to prove our sector. // Wait until we need to prove our sector.
for { for {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
if di.Index == evilSectorLoc.Deadline && di.CurrentEpoch-di.PeriodStart > 1 { if di.Index == evilSectorLoc.Deadline && di.CurrentEpoch-di.PeriodStart > 1 {
@ -114,6 +118,7 @@ func TestWindowPostDispute(t *testing.T) {
// Wait until after the proving period. // Wait until after the proving period.
for { for {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
if di.Index != evilSectorLoc.Deadline { if di.Index != evilSectorLoc.Deadline {
@ -124,6 +129,7 @@ func TestWindowPostDispute(t *testing.T) {
t.Log("accepted evil proof") t.Log("accepted evil proof")
//stm: @CHAIN_STATE_MINER_POWER_001
// Make sure the evil node didn't lose any power. // Make sure the evil node didn't lose any power.
p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -150,11 +156,13 @@ func TestWindowPostDispute(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
t.Log("waiting dispute") t.Log("waiting dispute")
//stm: @CHAIN_STATE_WAIT_MSG_001
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.Zero(t, rec.Receipt.ExitCode, "dispute not accepted: %s", rec.Receipt.ExitCode.Error()) require.Zero(t, rec.Receipt.ExitCode, "dispute not accepted: %s", rec.Receipt.ExitCode.Error())
} }
//stm: @CHAIN_STATE_MINER_POWER_001
// Objection SUSTAINED! // Objection SUSTAINED!
// Make sure the evil node lost power. // Make sure the evil node lost power.
p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
@ -167,6 +175,7 @@ func TestWindowPostDispute(t *testing.T) {
// First, recover the sector. // First, recover the sector.
{ {
//stm: @CHAIN_STATE_MINER_INFO_001
minerInfo, err := client.StateMinerInfo(ctx, evilMinerAddr, types.EmptyTSK) minerInfo, err := client.StateMinerInfo(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -191,6 +200,7 @@ func TestWindowPostDispute(t *testing.T) {
sm, err := client.MpoolPushMessage(ctx, msg, nil) sm, err := client.MpoolPushMessage(ctx, msg, nil)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_WAIT_MSG_001
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
require.NoError(t, err) require.NoError(t, err)
require.Zero(t, rec.Receipt.ExitCode, "recovery not accepted: %s", rec.Receipt.ExitCode.Error()) require.Zero(t, rec.Receipt.ExitCode, "recovery not accepted: %s", rec.Receipt.ExitCode.Error())
@ -198,6 +208,7 @@ func TestWindowPostDispute(t *testing.T) {
// Then wait for the deadline. // Then wait for the deadline.
for { for {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
if di.Index == evilSectorLoc.Deadline { if di.Index == evilSectorLoc.Deadline {
@ -219,6 +230,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
//stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01 //stm: @BLOCKCHAIN_SYNCER_START_001, @BLOCKCHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_01
//stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001 //stm: @BLOCKCHAIN_SYNCER_COLLECT_CHAIN_001, @BLOCKCHAIN_SYNCER_COLLECT_HEADERS_001, @BLOCKCHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001 //stm: @BLOCKCHAIN_SYNCER_NEW_PEER_HEAD_001, @BLOCKCHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @BLOCKCHAIN_SYNCER_STOP_001
//stm: @CHAIN_STATE_MINER_GET_DEADLINES_001
kit.Expensive(t) kit.Expensive(t)
kit.QuietMiningLogs() kit.QuietMiningLogs()
@ -241,6 +253,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
miner.PledgeSectors(ctx, 10, 0, nil) miner.PledgeSectors(ctx, 10, 0, nil)
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -255,6 +268,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
expectedPower := types.NewInt(uint64(ssz) * (kit.DefaultPresealsPerBootstrapMiner + 10)) expectedPower := types.NewInt(uint64(ssz) * (kit.DefaultPresealsPerBootstrapMiner + 10))
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -280,6 +294,7 @@ waitForProof:
} }
for { for {
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
// wait until the deadline finishes. // wait until the deadline finishes.
@ -323,11 +338,13 @@ func submitBadProof(
return err return err
} }
//stm: @CHAIN_STATE_MINER_INFO_001
minerInfo, err := client.StateMinerInfo(ctx, maddr, head.Key()) minerInfo, err := client.StateMinerInfo(ctx, maddr, head.Key())
if err != nil { if err != nil {
return err return err
} }
//stm: @CHAIN_STATE_GET_RANDOMNESS_FROM_TICKETS_001
commEpoch := di.Open commEpoch := di.Open
commRand, err := client.StateGetRandomnessFromTickets( commRand, err := client.StateGetRandomnessFromTickets(
ctx, crypto.DomainSeparationTag_PoStChainCommit, ctx, crypto.DomainSeparationTag_PoStChainCommit,
@ -364,6 +381,7 @@ func submitBadProof(
return err return err
} }
//stm: @CHAIN_STATE_WAIT_MSG_001
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true) rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
if err != nil { if err != nil {
return err return err

View File

@ -63,6 +63,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -76,6 +77,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
//stm: @CHAIN_STATE_MINER_POWER_001
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -89,6 +91,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
// Drop 2 sectors from deadline 2 partition 0 (full partition / deadline) // Drop 2 sectors from deadline 2 partition 0 (full partition / deadline)
{ {
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
parts, err := client.StateMinerPartitions(ctx, maddr, 2, types.EmptyTSK) parts, err := client.StateMinerPartitions(ctx, maddr, 2, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Greater(t, len(parts), 0) require.Greater(t, len(parts), 0)
@ -114,6 +117,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
// Drop 1 sectors from deadline 3 partition 0 // Drop 1 sectors from deadline 3 partition 0
{ {
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
parts, err := client.StateMinerPartitions(ctx, maddr, 3, types.EmptyTSK) parts, err := client.StateMinerPartitions(ctx, maddr, 3, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
require.Greater(t, len(parts), 0) require.Greater(t, len(parts), 0)
@ -142,6 +146,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.NoError(t, err) require.NoError(t, err)
} }
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -152,6 +157,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil)) ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
//stm: @CHAIN_STATE_MINER_POWER_001
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -165,6 +171,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
err = miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkFailed(s, false) err = miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkFailed(s, false)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -174,6 +181,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil)) ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
//stm: @CHAIN_STATE_MINER_POWER_001
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -188,6 +196,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
{ {
// Wait until proven. // Wait until proven.
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK) di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -198,6 +207,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
} }
//stm: @CHAIN_STATE_MINER_POWER_001
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -234,10 +244,12 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_INFO_001
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK) mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
miner.PledgeSectors(ctx, nSectors, 0, nil) miner.PledgeSectors(ctx, nSectors, 0, nil)
//stm: @CHAIN_STATE_GET_ACTOR_001
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
en := wact.Nonce en := wact.Nonce
@ -246,6 +258,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
waitForProof: waitForProof:
for { for {
//stm: @CHAIN_STATE_GET_ACTOR_001
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
if wact.Nonce > en { if wact.Nonce > en {
@ -255,9 +268,11 @@ waitForProof:
build.Clock.Sleep(blocktime) build.Clock.Sleep(blocktime)
} }
//stm: @CHAIN_STATE_LIST_MESSAGES_001
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0) slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_REPLAY_001
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0]) pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
require.NoError(t, err) require.NoError(t, err)
@ -284,10 +299,12 @@ func TestWindowPostBaseFeeBurn(t *testing.T) {
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_MINER_INFO_001
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK) mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
miner.PledgeSectors(ctx, 10, 0, nil) miner.PledgeSectors(ctx, 10, 0, nil)
//stm: @CHAIN_STATE_GET_ACTOR_001
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
en := wact.Nonce en := wact.Nonce
@ -296,6 +313,7 @@ func TestWindowPostBaseFeeBurn(t *testing.T) {
waitForProof: waitForProof:
for { for {
//stm: @CHAIN_STATE_GET_ACTOR_001
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
if wact.Nonce > en { if wact.Nonce > en {
@ -305,9 +323,11 @@ waitForProof:
build.Clock.Sleep(blocktime) build.Clock.Sleep(blocktime)
} }
//stm: @CHAIN_STATE_LIST_MESSAGES_001
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0) slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
require.NoError(t, err) require.NoError(t, err)
//stm: @CHAIN_STATE_REPLAY_001
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0]) pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
require.NoError(t, err) require.NoError(t, err)

View File

@ -1,3 +1,4 @@
//stm: #unit
package retrievaladapter package retrievaladapter
import ( import (
@ -18,6 +19,7 @@ import (
) )
func TestGetPricingInput(t *testing.T) { func TestGetPricingInput(t *testing.T) {
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001
ctx := context.Background() ctx := context.Background()
tsk := &types.TipSet{} tsk := &types.TipSet{}
key := tsk.Key() key := tsk.Key()

View File

@ -1,3 +1,4 @@
//stm: #unit
package storageadapter package storageadapter
import ( import (
@ -27,6 +28,7 @@ import (
) )
func TestDealStateMatcher(t *testing.T) { func TestDealStateMatcher(t *testing.T) {
//stm: @CHAIN_STATE_GET_ACTOR_001
ctx := context.Background() ctx := context.Background()
bs := bstore.NewMemorySync() bs := bstore.NewMemorySync()
store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs)) store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))