Annotate state feature tests
This commit is contained in:
parent
f04bae3f0b
commit
0169d0dafd
@ -717,6 +717,7 @@ func TestDuplicateNonce(t *testing.T) {
|
||||
|
||||
var includedMsg 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)
|
||||
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)
|
||||
|
||||
// Produce a message from the banker
|
||||
//stm: @CHAIN_STATE_LOOKUP_ID_001
|
||||
makeMsg := func(id bool) *types.SignedMessage {
|
||||
sender := tu.g.Banker()
|
||||
if id {
|
||||
@ -880,6 +882,7 @@ func TestMatchedNoncesRobustID(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Produce a message from the banker with specified nonce
|
||||
//stm: @CHAIN_STATE_LOOKUP_ID_001
|
||||
makeMsg := func(n uint64, id bool) *types.SignedMessage {
|
||||
sender := tu.g.Banker()
|
||||
if id {
|
||||
|
3
extern/storage-sealing/commit_batch_test.go
vendored
3
extern/storage-sealing/commit_batch_test.go
vendored
@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@ -28,6 +29,7 @@ import (
|
||||
)
|
||||
|
||||
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")
|
||||
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 {
|
||||
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)
|
||||
|
@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@ -38,6 +39,7 @@ var fc = config.MinerFeeConfig{
|
||||
}
|
||||
|
||||
func TestPrecommitBatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
t0123, err := address.NewFromString("t0123")
|
||||
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 {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
|
||||
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 {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
|
2
extern/storage-sealing/states_failed_test.go
vendored
2
extern/storage-sealing/states_failed_test.go
vendored
@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package sealing_test
|
||||
|
||||
import (
|
||||
@ -47,6 +48,7 @@ func TestStateRecoverDealIDs(t *testing.T) {
|
||||
PieceCID: idCid("newPieceCID"),
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
api.EXPECT().StateMarketStorageDealProposal(ctx, dealId, nil).Return(dealProposal, nil)
|
||||
|
||||
pc := idCid("publishCID")
|
||||
|
@ -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_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: @CHAIN_STATE_MINER_INFO_001
|
||||
t.Run("direct", func(t *testing.T) {
|
||||
runAPITest(t)
|
||||
})
|
||||
@ -121,11 +123,13 @@ func (ts *apiSuite) testSearchMsg(t *testing.T) {
|
||||
sm, err := full.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err := full.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
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)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, searchRes)
|
||||
|
@ -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_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: @CHAIN_STATE_MINER_GET_INFO_001
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
for _, height := range []abi.ChainEpoch{
|
||||
@ -90,6 +92,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
|
||||
require.Less(t, 50000, int(exp.OnTime))
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
dlInfo, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -113,6 +113,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
{
|
||||
minerC.PledgeSectors(ctx, sectorsC, 0, nil)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err := client.StateMinerProvingDeadline(ctx, maddrC, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -132,6 +133,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
|
||||
expectedPower := types.NewInt(uint64(ssz) * sectorsC)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, maddrC, types.EmptyTSK)
|
||||
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) {
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, ma, tsk)
|
||||
require.NoError(t, err)
|
||||
|
||||
// make sure it has the expected power.
|
||||
require.Equal(t, p.MinerPower.RawBytePower, power)
|
||||
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
mact, err := client.StateGetActor(ctx, ma, tsk)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -192,6 +196,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
checkMiner(maddrB, types.NewInt(0), true, true, uts.Key())
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_NETWORK_VERSION_001
|
||||
nv, err := client.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.GreaterOrEqual(t, nv, network.Version12)
|
||||
@ -251,6 +256,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
r, err := client.StateWaitMsg(ctx, m.Cid(), 2, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)
|
||||
@ -303,6 +309,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
sectorbit := bitfield.New()
|
||||
sectorbit.Set(uint64(sectorNum))
|
||||
|
||||
//stm: @CHAIN_STATE_SECTOR_PARTITION_001
|
||||
loca, err := client.StateSectorPartition(ctx, maddrD, sectorNum, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -334,6 +341,7 @@ func TestDeadlineToggling(t *testing.T) {
|
||||
|
||||
t.Log("sent termination message:", smsg.Cid())
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
r, err := client.StateWaitMsg(ctx, smsg.Cid(), 2, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, exitcode.Ok, r.Receipt.ExitCode)
|
||||
|
@ -108,6 +108,7 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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)
|
||||
require.NoError(t, err)
|
||||
count := 0
|
||||
|
@ -121,6 +121,7 @@ func TestGatewayWalletMsig(t *testing.T) {
|
||||
addProposal, err := doSend(proto)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err := lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
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
|
||||
// than initial amount
|
||||
msig := execReturn.IDAddress
|
||||
//stm: @CHAIN_STATE_MINER_AVAILABLE_BALANCE_001
|
||||
msigBalance, err := lite.MsigGetAvailableBalance(ctx, msig, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Greater(t, msigBalance.Int64(), int64(0))
|
||||
@ -144,6 +146,7 @@ func TestGatewayWalletMsig(t *testing.T) {
|
||||
addProposal, err = doSend(proto)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err = lite.StateWaitMsg(ctx, addProposal, 1, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode)
|
||||
@ -161,6 +164,7 @@ func TestGatewayWalletMsig(t *testing.T) {
|
||||
approval1, err := doSend(proto)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err = lite.StateWaitMsg(ctx, approval1, 1, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode)
|
||||
|
@ -89,6 +89,7 @@ func TestChainGetMessagesInTs(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, sm := range sms {
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
msgLookup, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -56,6 +56,7 @@ func TestNonceIncremental(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, sm := range sms {
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
_, err := client.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
preds := state.NewStatePredicates(paymentCreator)
|
||||
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) {
|
||||
act, err := paymentCreator.StateGetActor(ctx, channel, ts.Key())
|
||||
if err != nil {
|
||||
@ -187,6 +188,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
|
||||
collectMsg, err := paymentReceiver.PaychCollect(ctx, channel)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err = paymentReceiver.StateWaitMsg(ctx, collectMsg, 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode, "unable to collect on payment channel")
|
||||
|
@ -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_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: @CHAIN_STATE_NETWORK_VERSION_001
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
// oldDelay := policy.GetPreCommitChallengeDelay()
|
||||
|
@ -182,6 +182,7 @@ func TestPledgeMaxBatching(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, miner5.MaxAggregatedSectors+kit.DefaultPresealsPerBootstrapMiner, len(sectorInfosAfter))
|
||||
|
@ -38,6 +38,7 @@ func TestTerminate(t *testing.T) {
|
||||
ssz, err := miner.ActorSectorSize(ctx, maddr)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, p.MinerPower, p.TotalPower)
|
||||
@ -50,6 +51,7 @@ func TestTerminate(t *testing.T) {
|
||||
t.Log("wait for power")
|
||||
|
||||
{
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
// Wait until proven.
|
||||
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
@ -63,6 +65,7 @@ func TestTerminate(t *testing.T) {
|
||||
|
||||
nSectors++
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, p.MinerPower, p.TotalPower)
|
||||
@ -116,6 +119,7 @@ loop:
|
||||
// need to wait for message to be mined and applied.
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
// check power decreased
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
@ -124,6 +128,7 @@ loop:
|
||||
|
||||
// check in terminated set
|
||||
{
|
||||
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
|
||||
parts, err := client.StateMinerPartitions(ctx, maddr, 1, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Greater(t, len(parts), 0)
|
||||
@ -138,6 +143,7 @@ loop:
|
||||
require.Equal(t, uint64(0), bflen(parts[0].LiveSectors))
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -146,6 +152,7 @@ loop:
|
||||
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
||||
t.Logf("Now head.Height = %d", ts.Height())
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -56,6 +56,7 @@ func TestVerifiedClientTopUp(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// get VRH
|
||||
//stm: @CHAIN_STATE_VERIFIED_REGISTRY_ROOT_KEY_001
|
||||
vrh, err := api.StateVerifiedRegistryRootKey(ctx, types.TipSetKey{})
|
||||
fmt.Println(vrh.String())
|
||||
require.NoError(t, err)
|
||||
@ -86,6 +87,7 @@ func TestVerifiedClientTopUp(t *testing.T) {
|
||||
sm, err := api.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err, "AddVerifier failed")
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err := api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode)
|
||||
@ -107,11 +109,13 @@ func TestVerifiedClientTopUp(t *testing.T) {
|
||||
sm, err = api.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
res, err = api.StateWaitMsg(ctx, sm.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode)
|
||||
|
||||
// check datacap balance
|
||||
//stm: @CHAIN_STATE_VERIFIED_CLIENT_STATUS_001
|
||||
dcap, err := api.StateVerifiedClientStatus(ctx, verifiedClientAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -66,6 +66,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
evilMinerAddr, err := evilMiner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err := client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -77,6 +78,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
|
||||
t.Logf("Now head.Height = %d", ts.Height())
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -89,6 +91,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
evilSectors, err := evilMiner.SectorsList(ctx)
|
||||
require.NoError(t, err)
|
||||
evilSectorNo := evilSectors[0] // only one.
|
||||
//stm: @CHAIN_STATE_SECTOR_PARTITION_001
|
||||
evilSectorLoc, err := client.StateSectorPartition(ctx, evilMinerAddr, evilSectorNo, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -101,6 +104,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
|
||||
// Wait until we need to prove our sector.
|
||||
for {
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
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.
|
||||
for {
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if di.Index != evilSectorLoc.Deadline {
|
||||
@ -124,6 +129,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
|
||||
t.Log("accepted evil proof")
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
// Make sure the evil node didn't lose any power.
|
||||
p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
@ -150,11 +156,13 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Log("waiting dispute")
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
require.Zero(t, rec.Receipt.ExitCode, "dispute not accepted: %s", rec.Receipt.ExitCode.Error())
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
// Objection SUSTAINED!
|
||||
// Make sure the evil node lost power.
|
||||
p, err = client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
@ -167,6 +175,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
// First, recover the sector.
|
||||
|
||||
{
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001
|
||||
minerInfo, err := client.StateMinerInfo(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -191,6 +200,7 @@ func TestWindowPostDispute(t *testing.T) {
|
||||
sm, err := client.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
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.
|
||||
for {
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, evilMinerAddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
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_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: @CHAIN_STATE_MINER_GET_DEADLINES_001
|
||||
kit.Expensive(t)
|
||||
|
||||
kit.QuietMiningLogs()
|
||||
@ -241,6 +253,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
|
||||
|
||||
miner.PledgeSectors(ctx, 10, 0, nil)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -255,6 +268,7 @@ func TestWindowPostDisputeFails(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
expectedPower := types.NewInt(uint64(ssz) * (kit.DefaultPresealsPerBootstrapMiner + 10))
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -280,6 +294,7 @@ waitForProof:
|
||||
}
|
||||
|
||||
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.
|
||||
@ -323,11 +338,13 @@ func submitBadProof(
|
||||
return err
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001
|
||||
minerInfo, err := client.StateMinerInfo(ctx, maddr, head.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_GET_RANDOMNESS_FROM_TICKETS_001
|
||||
commEpoch := di.Open
|
||||
commRand, err := client.StateGetRandomnessFromTickets(
|
||||
ctx, crypto.DomainSeparationTag_PoStChainCommit,
|
||||
@ -364,6 +381,7 @@ func submitBadProof(
|
||||
return err
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_WAIT_MSG_001
|
||||
rec, err := client.StateWaitMsg(ctx, sm.Cid(), build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -63,6 +63,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
maddr, err := miner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err := client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
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))
|
||||
t.Logf("Now head.Height = %d", ts.Height())
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
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)
|
||||
{
|
||||
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
|
||||
parts, err := client.StateMinerPartitions(ctx, maddr, 2, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
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
|
||||
{
|
||||
//stm: @CHAIN_STATE_MINER_GET_PARTITIONS_001
|
||||
parts, err := client.StateMinerPartitions(ctx, maddr, 3, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Greater(t, len(parts), 0)
|
||||
@ -142,6 +146,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
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))
|
||||
t.Logf("Now head.Height = %d", ts.Height())
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
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)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
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))
|
||||
t.Logf("Now head.Height = %d", ts.Height())
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -188,6 +196,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
|
||||
{
|
||||
// Wait until proven.
|
||||
//stm: @CHAIN_STATE_MINER_CALCULATE_DEADLINE_001
|
||||
di, err = client.StateMinerProvingDeadline(ctx, maddr, types.EmptyTSK)
|
||||
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())
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_POWER_001
|
||||
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -234,10 +244,12 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
|
||||
maddr, err := miner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001
|
||||
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
miner.PledgeSectors(ctx, nSectors, 0, nil)
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en := wact.Nonce
|
||||
@ -246,6 +258,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
|
||||
|
||||
waitForProof:
|
||||
for {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en {
|
||||
@ -255,9 +268,11 @@ waitForProof:
|
||||
build.Clock.Sleep(blocktime)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_LIST_MESSAGES_001
|
||||
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_REPLAY_001
|
||||
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -284,10 +299,12 @@ func TestWindowPostBaseFeeBurn(t *testing.T) {
|
||||
maddr, err := miner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001
|
||||
mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
|
||||
miner.PledgeSectors(ctx, 10, 0, nil)
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
en := wact.Nonce
|
||||
@ -296,6 +313,7 @@ func TestWindowPostBaseFeeBurn(t *testing.T) {
|
||||
|
||||
waitForProof:
|
||||
for {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
if wact.Nonce > en {
|
||||
@ -305,9 +323,11 @@ waitForProof:
|
||||
build.Clock.Sleep(blocktime)
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_LIST_MESSAGES_001
|
||||
slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
//stm: @CHAIN_STATE_REPLAY_001
|
||||
pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package retrievaladapter
|
||||
|
||||
import (
|
||||
@ -18,6 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPricingInput(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001
|
||||
ctx := context.Background()
|
||||
tsk := &types.TipSet{}
|
||||
key := tsk.Key()
|
||||
|
@ -1,3 +1,4 @@
|
||||
//stm: #unit
|
||||
package storageadapter
|
||||
|
||||
import (
|
||||
@ -27,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDealStateMatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_GET_ACTOR_001
|
||||
ctx := context.Background()
|
||||
bs := bstore.NewMemorySync()
|
||||
store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))
|
||||
|
Loading…
Reference in New Issue
Block a user