Fixups
This commit is contained in:
parent
b5ba7a0fad
commit
9e48dd211a
@ -39,7 +39,7 @@ type State interface {
|
||||
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
||||
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
|
||||
LoadSectorsFromSet(filter *bitfield.BitField, filterOut bool) (adt.Array, error)
|
||||
LoadPreCommittedSectorsFromSet(filter *bitfield.BitField, filterOut bool) (adt.Map, error)
|
||||
LoadPreCommittedSectors() (adt.Map, error)
|
||||
IsAllocated(abi.SectorNumber) (bool, error)
|
||||
|
||||
LoadDeadline(idx uint64) (Deadline, error)
|
||||
|
@ -302,7 +302,7 @@ func (sp *StatePredicates) AvailableBalanceChangedForAddresses(getAddrs func() [
|
||||
}
|
||||
}
|
||||
|
||||
type DiffMinerActorStateFunc func(ctx context.Context, oldState *miner.State, newState *miner.State) (changed bool, user UserData, err error)
|
||||
type DiffMinerActorStateFunc func(ctx context.Context, oldState miner.State, newState miner.State) (changed bool, user UserData, err error)
|
||||
|
||||
func (sp *StatePredicates) OnInitActorChange(diffInitActorState DiffInitActorStateFunc) DiffTipSetKeyFunc {
|
||||
return sp.OnActorStateChanged(builtin.InitActorAddr, func(ctx context.Context, oldActorState, newActorState *types.Actor) (changed bool, user UserData, err error) {
|
||||
@ -329,7 +329,7 @@ func (sp *StatePredicates) OnMinerActorChange(minerAddr address.Address, diffMin
|
||||
if err := sp.cst.Get(ctx, newActorState.Head, &newState); err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return diffMinerActorState(ctx, &oldState, &newState)
|
||||
return diffMinerActorState(ctx, oldState, newState)
|
||||
})
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ func (m *MinerSectorChanges) Remove(key uint64, val *typegen.Deferred) error {
|
||||
}
|
||||
|
||||
func (sp *StatePredicates) OnMinerSectorChange() DiffMinerActorStateFunc {
|
||||
return func(ctx context.Context, oldState, newState *miner.State) (changed bool, user UserData, err error) {
|
||||
return func(ctx context.Context, oldState, newState miner.State) (changed bool, user UserData, err error) {
|
||||
sectorChanges := &MinerSectorChanges{
|
||||
Added: []miner.SectorOnChainInfo{},
|
||||
Extended: []SectorExtensions{},
|
||||
@ -457,7 +457,7 @@ func (m *MinerPreCommitChanges) Remove(key string, val *typegen.Deferred) error
|
||||
}
|
||||
|
||||
func (sp *StatePredicates) OnMinerPreCommitChange() DiffMinerActorStateFunc {
|
||||
return func(ctx context.Context, oldState, newState *miner.State) (changed bool, user UserData, err error) {
|
||||
return func(ctx context.Context, oldState, newState miner.State) (changed bool, user UserData, err error) {
|
||||
precommitChanges := &MinerPreCommitChanges{
|
||||
Added: []miner.SectorPreCommitOnChainInfo{},
|
||||
Removed: []miner.SectorPreCommitOnChainInfo{},
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
saruntime "github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
|
||||
@ -156,7 +158,29 @@ func GetMinerSectorSet(ctx context.Context, sm *StateManager, ts *types.TipSet,
|
||||
return nil, xerrors.Errorf("(get sset) failed to load miner actor state: %w", err)
|
||||
}
|
||||
|
||||
return mas.LoadSectorsFromSet(filter, filterOut)
|
||||
sectors, err := mas.LoadSectorsFromSet(filter, filterOut)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("(get sset) failed to load sectors: %w", err)
|
||||
}
|
||||
|
||||
var sset []*miner.ChainSectorInfo
|
||||
var v cbg.Deferred
|
||||
if err := sectors.ForEach(&v, func(i int64) error {
|
||||
var oci v0miner.SectorOnChainInfo
|
||||
if err := oci.UnmarshalCBOR(bytes.NewReader(v.Raw)); err != nil {
|
||||
return err
|
||||
}
|
||||
sset = append(sset, &miner.ChainSectorInfo{
|
||||
Info: oci,
|
||||
ID: abi.SectorNumber(i),
|
||||
})
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return sset, nil
|
||||
}
|
||||
|
||||
func GetSectorsForWinningPoSt(ctx context.Context, pv ffiwrapper.Verifier, sm *StateManager, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]proof.SectorInfo, error) {
|
||||
@ -220,12 +244,21 @@ func GetSectorsForWinningPoSt(ctx context.Context, pv ffiwrapper.Verifier, sm *S
|
||||
|
||||
out := make([]proof.SectorInfo, len(ids))
|
||||
for i, n := range ids {
|
||||
s := sectors[n]
|
||||
var sinfo miner.SectorOnChainInfo
|
||||
found, err := sectors.Get(n, &sinfo)
|
||||
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("loading sector info: %w", err)
|
||||
}
|
||||
|
||||
if !found {
|
||||
return nil, xerrors.Errorf("didn't find sector info for sector %d", n)
|
||||
}
|
||||
|
||||
out[i] = proof.SectorInfo{
|
||||
SealProof: spt,
|
||||
SectorNumber: s.ID,
|
||||
SealedCID: s.Info.SealedCID,
|
||||
SectorNumber: sinfo.SectorNumber,
|
||||
SealedCID: sinfo.SealedCID,
|
||||
}
|
||||
}
|
||||
|
||||
|
5
extern/storage-sealing/states_sealing.go
vendored
5
extern/storage-sealing/states_sealing.go
vendored
@ -282,11 +282,6 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
|
||||
return ctx.Send(SectorChainPreCommitFailed{error: xerrors.Errorf("precommit info not found on chain")})
|
||||
}
|
||||
|
||||
nv, err := m.api.StateNetworkVersion(ctx.Context(), tok)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("failed to get network version: %w", err)})
|
||||
}
|
||||
|
||||
pccd, err := m.getPreCommitChallengeDelay(ctx.Context(), tok)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("failed to get precommit challenge delay: %w", err)})
|
||||
|
Loading…
Reference in New Issue
Block a user