sealing pipeline: Rename 'tok' to 'tsk'

This commit is contained in:
Łukasz Magiera 2022-06-17 11:20:33 +02:00
parent d56241603a
commit 4a4d64f528
11 changed files with 49 additions and 49 deletions

View File

@ -91,12 +91,12 @@ func checkPieces(ctx context.Context, maddr address.Address, si SectorInfo, api
// checkPrecommit checks that data commitment generated in the sealing process // checkPrecommit checks that data commitment generated in the sealing process
// matches pieces, and that the seal ticket isn't expired // matches pieces, and that the seal ticket isn't expired
func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, tok types.TipSetKey, height abi.ChainEpoch, api SealingAPI) (err error) { func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, tsk types.TipSetKey, height abi.ChainEpoch, api SealingAPI) (err error) {
if err := checkPieces(ctx, maddr, si, api, false); err != nil { if err := checkPieces(ctx, maddr, si, api, false); err != nil {
return err return err
} }
commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tok) commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
if err != nil { if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)} return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
} }
@ -105,7 +105,7 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)} return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
} }
pci, err := api.StateSectorPreCommitInfo(ctx, maddr, si.SectorNumber, tok) pci, err := api.StateSectorPreCommitInfo(ctx, maddr, si.SectorNumber, tsk)
if err != nil { if err != nil {
return &ErrApi{xerrors.Errorf("getting precommit info: %w", err)} return &ErrApi{xerrors.Errorf("getting precommit info: %w", err)}
} }
@ -118,7 +118,7 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return &ErrPrecommitOnChain{xerrors.Errorf("precommit already on chain")} return &ErrPrecommitOnChain{xerrors.Errorf("precommit already on chain")}
} }
alloc, err := api.StateMinerSectorAllocated(ctx, maddr, si.SectorNumber, tok) alloc, err := api.StateMinerSectorAllocated(ctx, maddr, si.SectorNumber, tsk)
if err != nil { if err != nil {
return xerrors.Errorf("checking if sector is allocated: %w", err) return xerrors.Errorf("checking if sector is allocated: %w", err)
} }
@ -136,18 +136,18 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return nil return nil
} }
func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte, tok types.TipSetKey) (err error) { func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte, tsk types.TipSetKey) (err error) {
if si.SeedEpoch == 0 { if si.SeedEpoch == 0 {
return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")} return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")}
} }
pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tok) pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tsk)
if err != nil { if err != nil {
return xerrors.Errorf("getting precommit info: %w", err) return xerrors.Errorf("getting precommit info: %w", err)
} }
if pci == nil { if pci == nil {
alloc, err := m.Api.StateMinerSectorAllocated(ctx, m.maddr, si.SectorNumber, tok) alloc, err := m.Api.StateMinerSectorAllocated(ctx, m.maddr, si.SectorNumber, tsk)
if err != nil { if err != nil {
return xerrors.Errorf("checking if sector is allocated: %w", err) return xerrors.Errorf("checking if sector is allocated: %w", err)
} }
@ -174,7 +174,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
return err return err
} }
seed, err := m.Api.StateGetRandomnessFromBeacon(ctx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, si.SeedEpoch, buf.Bytes(), tok) seed, err := m.Api.StateGetRandomnessFromBeacon(ctx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, si.SeedEpoch, buf.Bytes(), tsk)
if err != nil { if err != nil {
return &ErrApi{xerrors.Errorf("failed to get randomness for computing seal proof: %w", err)} return &ErrApi{xerrors.Errorf("failed to get randomness for computing seal proof: %w", err)}
} }
@ -211,7 +211,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
} }
// check that sector info is good after running a replica update // check that sector info is good after running a replica update
func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInfo, tok types.TipSetKey, api SealingAPI) error { func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInfo, tsk types.TipSetKey, api SealingAPI) error {
if err := checkPieces(ctx, maddr, si, api, true); err != nil { if err := checkPieces(ctx, maddr, si, api, true); err != nil {
return err return err
@ -220,7 +220,7 @@ func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInf
return xerrors.Errorf("replica update on sector not marked for update") return xerrors.Errorf("replica update on sector not marked for update")
} }
commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tok) commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
if err != nil { if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)} return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
} }

View File

@ -39,9 +39,9 @@ type CommitBatcherApi interface {
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
ChainHead(ctx context.Context) (*types.TipSet, error) ChainHead(ctx context.Context) (*types.TipSet, error)
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error) StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
} }
@ -427,7 +427,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
return res, nil return res, nil
} }
func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tok types.TipSetKey) (cid.Cid, error) { func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tsk types.TipSetKey) (cid.Cid, error) {
enc := new(bytes.Buffer) enc := new(bytes.Buffer)
params := &miner.ProveCommitSectorParams{ params := &miner.ProveCommitSectorParams{
SectorNumber: sn, SectorNumber: sn,
@ -438,7 +438,7 @@ func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, av
return cid.Undef, xerrors.Errorf("marshaling commit params: %w", err) return cid.Undef, xerrors.Errorf("marshaling commit params: %w", err)
} }
collateral, err := b.getSectorCollateral(sn, tok) collateral, err := b.getSectorCollateral(sn, tsk)
if err != nil { if err != nil {
return cid.Undef, err return cid.Undef, err
} }
@ -604,8 +604,8 @@ func (b *CommitBatcher) getCommitCutoff(si SectorInfo) (time.Time, error) {
return time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(build.BlockDelaySecs) * time.Second), nil return time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(build.BlockDelaySecs) * time.Second), nil
} }
func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tok types.TipSetKey) (abi.TokenAmount, error) { func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tsk types.TipSetKey) (abi.TokenAmount, error) {
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tok) pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tsk)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("getting precommit info: %w", err) return big.Zero(), xerrors.Errorf("getting precommit info: %w", err)
} }
@ -613,7 +613,7 @@ func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tok types.TipSe
return big.Zero(), xerrors.Errorf("precommit info not found on chain") return big.Zero(), xerrors.Errorf("precommit info not found on chain")
} }
collateral, err := b.api.StateMinerInitialPledgeCollateral(b.mctx, b.maddr, pci.Info, tok) collateral, err := b.api.StateMinerInitialPledgeCollateral(b.mctx, b.maddr, pci.Info, tsk)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("getting initial pledge collateral: %w", err) return big.Zero(), xerrors.Errorf("getting initial pledge collateral: %w", err)
} }

View File

@ -24,7 +24,7 @@ type CurrentDealInfoAPI interface {
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
} }
type CurrentDealInfo struct { type CurrentDealInfo struct {
@ -40,19 +40,19 @@ type CurrentDealInfoManager struct {
// GetCurrentDealInfo gets the current deal state and deal ID. // GetCurrentDealInfo gets the current deal state and deal ID.
// Note that the deal ID is assigned when the deal is published, so it may // Note that the deal ID is assigned when the deal is published, so it may
// have changed if there was a reorg after the deal was published. // have changed if there was a reorg after the deal was published.
func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tok types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error) { func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error) {
// Lookup the deal ID by comparing the deal proposal to the proposals in // Lookup the deal ID by comparing the deal proposal to the proposals in
// the publish deals message, and indexing into the message return value // the publish deals message, and indexing into the message return value
dealID, pubMsgTok, err := mgr.dealIDFromPublishDealsMsg(ctx, tok, proposal, publishCid) dealID, pubMsgTok, err := mgr.dealIDFromPublishDealsMsg(ctx, tsk, proposal, publishCid)
if err != nil { if err != nil {
return CurrentDealInfo{}, err return CurrentDealInfo{}, err
} }
// Lookup the deal state by deal ID // Lookup the deal state by deal ID
marketDeal, err := mgr.CDAPI.StateMarketStorageDeal(ctx, dealID, tok) marketDeal, err := mgr.CDAPI.StateMarketStorageDeal(ctx, dealID, tsk)
if err == nil && proposal != nil { if err == nil && proposal != nil {
// Make sure the retrieved deal proposal matches the target proposal // Make sure the retrieved deal proposal matches the target proposal
equal, err := mgr.CheckDealEquality(ctx, tok, *proposal, marketDeal.Proposal) equal, err := mgr.CheckDealEquality(ctx, tsk, *proposal, marketDeal.Proposal)
if err != nil { if err != nil {
return CurrentDealInfo{}, err return CurrentDealInfo{}, err
} }
@ -65,11 +65,11 @@ func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tok t
// dealIDFromPublishDealsMsg looks up the publish deals message by cid, and finds the deal ID // dealIDFromPublishDealsMsg looks up the publish deals message by cid, and finds the deal ID
// by looking at the message return value // by looking at the message return value
func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context, tok types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (abi.DealID, types.TipSetKey, error) { func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (abi.DealID, types.TipSetKey, error) {
dealID := abi.DealID(0) dealID := abi.DealID(0)
// Get the return value of the publish deals message // Get the return value of the publish deals message
lookup, err := mgr.CDAPI.StateSearchMsg(ctx, tok, publishCid, api.LookbackNoLimit, true) lookup, err := mgr.CDAPI.StateSearchMsg(ctx, tsk, publishCid, api.LookbackNoLimit, true)
if err != nil { if err != nil {
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: search msg failed: %w", publishCid, err) return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: search msg failed: %w", publishCid, err)
} }
@ -131,7 +131,7 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
// index of the target deal proposal // index of the target deal proposal
dealIdx := -1 dealIdx := -1
for i, paramDeal := range pubDealsParams.Deals { for i, paramDeal := range pubDealsParams.Deals {
eq, err := mgr.CheckDealEquality(ctx, tok, *proposal, paramDeal.Proposal) eq, err := mgr.CheckDealEquality(ctx, tsk, *proposal, paramDeal.Proposal)
if err != nil { if err != nil {
return dealID, types.EmptyTSK, xerrors.Errorf("comparing publish deal message %s proposal to deal proposal: %w", publishCid, err) return dealID, types.EmptyTSK, xerrors.Errorf("comparing publish deal message %s proposal to deal proposal: %w", publishCid, err)
} }
@ -169,12 +169,12 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
return dealIDs[outIdx], lookup.TipSet, nil return dealIDs[outIdx], lookup.TipSet, nil
} }
func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tok types.TipSetKey, p1, p2 market.DealProposal) (bool, error) { func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tsk types.TipSetKey, p1, p2 market.DealProposal) (bool, error) {
p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tok) p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tsk)
if err != nil { if err != nil {
return false, err return false, err
} }
p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tok) p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tsk)
if err != nil { if err != nil {
return false, err return false, err
} }

View File

@ -359,7 +359,7 @@ func (mapi *CurrentDealInfoMockAPI) ChainGetMessage(ctx context.Context, c cid.C
}, nil }, nil
} }
func (mapi *CurrentDealInfoMockAPI) StateLookupID(ctx context.Context, addr address.Address, token types.TipSetKey) (address.Address, error) { func (mapi *CurrentDealInfoMockAPI) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
return addr, nil return addr, nil
} }
@ -379,7 +379,7 @@ func (mapi *CurrentDealInfoMockAPI) StateSearchMsg(ctx context.Context, from typ
return mapi.SearchMessageLookup, mapi.SearchMessageErr return mapi.SearchMessageLookup, mapi.SearchMessageErr
} }
func (mapi *CurrentDealInfoMockAPI) StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) { func (mapi *CurrentDealInfoMockAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
return mapi.Version, nil return mapi.Version, nil
} }

View File

@ -32,7 +32,7 @@ type PreCommitBatcherApi interface {
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
ChainHead(ctx context.Context) (*types.TipSet, error) ChainHead(ctx context.Context) (*types.TipSet, error)
StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
} }
type preCommitEntry struct { type preCommitEntry struct {
@ -309,7 +309,7 @@ func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo,
return mcid, nil return mcid, nil
} }
func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok types.TipSetKey, bf abi.TokenAmount, nv network.Version) ([]sealiface.PreCommitBatchRes, error) { func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tsk types.TipSetKey, bf abi.TokenAmount, nv network.Version) ([]sealiface.PreCommitBatchRes, error) {
params := miner.PreCommitSectorBatchParams{} params := miner.PreCommitSectorBatchParams{}
deposit := big.Zero() deposit := big.Zero()
var res sealiface.PreCommitBatchRes var res sealiface.PreCommitBatchRes

View File

@ -20,7 +20,7 @@ type PreCommitPolicy interface {
type Chain interface { type Chain interface {
ChainHead(context.Context) (*types.TipSet, error) ChainHead(context.Context) (*types.TipSet, error)
StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
} }
// BasicPreCommitPolicy satisfies PreCommitPolicy. It has two modes: // BasicPreCommitPolicy satisfies PreCommitPolicy. It has two modes:

View File

@ -42,7 +42,7 @@ func fakeConfigGetter(stub *fakeConfigStub) pipeline.GetSealingConfigFunc {
} }
} }
func (f *fakeChain) StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) { func (f *fakeChain) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
return build.NewestNetworkVersion, nil return build.NewestNetworkVersion, nil
} }

View File

@ -43,10 +43,10 @@ type SealingAPI interface {
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok types.TipSetKey) (cid.Cid, error) StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error)
StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorOnChainInfo, error) StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*lminer.SectorLocation, error) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error) StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error) StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
@ -54,15 +54,15 @@ type SealingAPI interface {
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error) StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error) StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
StateNetworkVersion(ctx context.Context, tok types.TipSetKey) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error) StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error) StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error)
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tok types.TipSetKey) ([]api.Partition, error) StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
ChainHead(ctx context.Context) (*types.TipSet, error) ChainHead(ctx context.Context) (*types.TipSet, error)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok types.TipSetKey) (abi.Randomness, error) StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error)
StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok types.TipSetKey) (abi.Randomness, error) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error)
ChainReadObj(context.Context, cid.Cid) ([]byte, error) ChainReadObj(context.Context, cid.Cid) ([]byte, error)
} }

View File

@ -381,7 +381,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
} }
} }
params, pcd, tok, err := m.preCommitParams(ctx, sector) params, pcd, tsk, err := m.preCommitParams(ctx, sector)
if err != nil { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)}) return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)})
} }
@ -399,7 +399,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)}) return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)})
} }
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tok) mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tsk)
if err != nil { if err != nil {
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err) log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
return nil return nil

View File

@ -25,11 +25,11 @@ import (
) )
type TerminateBatcherApi interface { type TerminateBatcherApi interface {
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*lminer.SectorLocation, error) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error) StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tok types.TipSetKey) ([]api.Partition, error) StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
} }
type TerminateBatcher struct { type TerminateBatcher struct {

View File

@ -50,14 +50,14 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
return m.sectors.Send(uint64(id), SectorMarkForUpdate{}) return m.sectors.Send(uint64(id), SectorMarkForUpdate{})
} }
func (m *Sealing) sectorActive(ctx context.Context, tok types.TipSetKey, sector abi.SectorNumber) (bool, error) { func (m *Sealing) sectorActive(ctx context.Context, tsk types.TipSetKey, sector abi.SectorNumber) (bool, error) {
dls, err := m.Api.StateMinerDeadlines(ctx, m.maddr, tok) dls, err := m.Api.StateMinerDeadlines(ctx, m.maddr, tsk)
if err != nil { if err != nil {
return false, xerrors.Errorf("getting proving deadlines: %w", err) return false, xerrors.Errorf("getting proving deadlines: %w", err)
} }
for dl := range dls { for dl := range dls {
parts, err := m.Api.StateMinerPartitions(ctx, m.maddr, uint64(dl), tok) parts, err := m.Api.StateMinerPartitions(ctx, m.maddr, uint64(dl), tsk)
if err != nil { if err != nil {
return false, xerrors.Errorf("getting partitions for deadline %d: %w", dl, err) return false, xerrors.Errorf("getting partitions for deadline %d: %w", dl, err)
} }