self review fixes

This commit is contained in:
whyrusleeping 2020-02-28 18:02:40 -08:00
parent 1a07cb7bbf
commit c7508a0512
6 changed files with 11 additions and 45 deletions

View File

@ -572,12 +572,11 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
return nil, nil return nil, nil
} }
if pset[0].Info.Info.RegisteredProof == 0 {
panic("registered proof coming from proving set is 0")
}
var sinfos []abi.SectorInfo var sinfos []abi.SectorInfo
for _, s := range pset { for _, s := range pset {
if s.Info.Info.RegisteredProof == 0 {
return nil, xerrors.Errorf("sector %d in proving set had registered type of zero", s.ID)
}
sinfos = append(sinfos, abi.SectorInfo{ sinfos = append(sinfos, abi.SectorInfo{
SectorNumber: s.ID, SectorNumber: s.ID,
SealedCID: s.Info.Info.SealedCID, SealedCID: s.Info.Info.SealedCID,

View File

@ -35,7 +35,6 @@ func NewFundMgr(sm *stmgr.StateManager, mpool full.MpoolAPI) *FundMgr {
} }
func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error { func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error {
log.Error("ensure available: ", addr, amt)
fm.lk.Lock() fm.lk.Lock()
avail, ok := fm.available[addr] avail, ok := fm.available[addr]
if !ok { if !ok {
@ -81,8 +80,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
_, r, err := fm.sm.WaitForMessage(ctx, smsg.Cid()) _, r, err := fm.sm.WaitForMessage(ctx, smsg.Cid())
if err != nil { if err != nil {
log.Error("waiting for message: ", err) return xerrors.Errorf("failed waiting for market AddBalance message: %w", err)
return err
} }
if r.ExitCode != 0 { if r.ExitCode != 0 {

View File

@ -76,7 +76,6 @@ func (ss *syscallShim) VerifyConsensusFault(a, b []byte) error {
} }
func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error { func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error {
//VerifyFallbackPost(ctx context.Context, sectorSize abi.SectorSize, sectorInfo SortedPublicSectorInfo, challengeSeed []byte, proof []byte, candidates []EPostCandidate, proverID address.Address, faults uint64) (bool, error)
ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof) ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof)
if err != nil { if err != nil {
return err return err

View File

@ -21,6 +21,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/abi/big"
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
@ -119,7 +120,7 @@ var preSealCmd = &cli.Command{
} }
} }
rp, err := registeredProofFromSsize(c.Uint64("sector-size")) rp, _, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(c.Uint64("sector-size")))
if err != nil { if err != nil {
return err return err
} }
@ -221,20 +222,15 @@ var aggregateSectorDirsCmd = &cli.Command{
ssize := abi.SectorSize(cctx.Uint64("sector-size")) ssize := abi.SectorSize(cctx.Uint64("sector-size"))
rp, err := registeredProofFromSsize(cctx.Uint64("sector-size")) ppt, spt, err := lapi.ProofTypeFromSectorSize(abi.SectorSize(cctx.Uint64("sector-size")))
if err != nil {
return err
}
sp, err := rp.RegisteredSealProof()
if err != nil { if err != nil {
return err return err
} }
agsb, err := sectorbuilder.New(&sectorbuilder.Config{ agsb, err := sectorbuilder.New(&sectorbuilder.Config{
Miner: maddr, Miner: maddr,
SealProofType: sp, SealProofType: spt,
PoStProofType: rp, PoStProofType: ppt,
Paths: sectorbuilder.SimplePath(destdir), Paths: sectorbuilder.SimplePath(destdir),
WorkerThreads: 2, WorkerThreads: 2,
}, namespace.Wrap(agmds, datastore.NewKey("/sectorbuilder"))) }, namespace.Wrap(agmds, datastore.NewKey("/sectorbuilder")))
@ -295,8 +291,8 @@ var aggregateSectorDirsCmd = &cli.Command{
sb, err := sectorbuilder.New(&sectorbuilder.Config{ sb, err := sectorbuilder.New(&sectorbuilder.Config{
Miner: maddr, Miner: maddr,
SealProofType: sp, SealProofType: spt,
PoStProofType: rp, PoStProofType: ppt,
Paths: sectorbuilder.SimplePath(dir), Paths: sectorbuilder.SimplePath(dir),
WorkerThreads: 2, WorkerThreads: 2,
}, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder"))) }, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder")))
@ -336,19 +332,3 @@ func mergeGenMiners(a, b genesis.Miner) genesis.Miner {
Sectors: append(a.Sectors, b.Sectors...), Sectors: append(a.Sectors, b.Sectors...),
} }
} }
func registeredProofFromSsize(ssize uint64) (abi.RegisteredProof, error) {
// TODO: this should be provided to us by something lower down...
switch ssize {
case 2 << 10:
return abi.RegisteredProof_StackedDRG2KiBPoSt, nil
case 32 << 30:
return abi.RegisteredProof_StackedDRG32GiBPoSt, nil
case 8 << 20:
return abi.RegisteredProof_StackedDRG8MiBPoSt, nil
case 512 << 20:
return abi.RegisteredProof_StackedDRG512MiBPoSt, nil
default:
return 0, fmt.Errorf("unsupported sector size: %d", ssize)
}
}

View File

@ -292,7 +292,6 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
for _, did := range params.DealIDs { for _, did := range params.DealIDs {
if did == abi.DealID(dealId) { if did == abi.DealID(dealId) {
log.Error("FOUND OUR SECTOR!", params.SectorNumber)
sectorNumber = params.SectorNumber sectorNumber = params.SectorNumber
sectorFound = true sectorFound = true
return false, nil return false, nil
@ -301,12 +300,10 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
return false, nil return false, nil
case builtin.MethodsMiner.ProveCommitSector: case builtin.MethodsMiner.ProveCommitSector:
log.Errorf("Look! a prove commit!")
var params miner.ProveCommitSectorParams var params miner.ProveCommitSectorParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err) return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)
} }
log.Warn("prove commit: ", params.SectorNumber, sectorFound, sectorNumber)
if !sectorFound { if !sectorFound {
return false, nil return false, nil
@ -316,7 +313,6 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
return false, nil return false, nil
} }
log.Warn("getting out of here")
return true, nil return true, nil
default: default:
return false, nil return false, nil

View File

@ -219,7 +219,6 @@ func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context
} }
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID uint64, cb storagemarket.DealSectorCommittedCallback) error { func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID uint64, cb storagemarket.DealSectorCommittedCallback) error {
log.Errorf("ON DEAL SECTOR COMMITTED", provider, dealID)
checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) { checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) {
sd, err := n.StateMarketStorageDeal(ctx, abi.DealID(dealID), ts.Key()) sd, err := n.StateMarketStorageDeal(ctx, abi.DealID(dealID), ts.Key())
@ -237,7 +236,6 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
called := func(msg *types.Message, rec *types.MessageReceipt, ts *types.TipSet, curH abi.ChainEpoch) (more bool, err error) { called := func(msg *types.Message, rec *types.MessageReceipt, ts *types.TipSet, curH abi.ChainEpoch) (more bool, err error) {
log.Errorf("CAllled callllllback")
defer func() { defer func() {
if err != nil { if err != nil {
cb(xerrors.Errorf("handling applied event: %w", err)) cb(xerrors.Errorf("handling applied event: %w", err))
@ -288,7 +286,6 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
for _, did := range params.DealIDs { for _, did := range params.DealIDs {
if did == abi.DealID(dealID) { if did == abi.DealID(dealID) {
log.Error("FOUND OUR SECTOR!", params.SectorNumber)
sectorNumber = params.SectorNumber sectorNumber = params.SectorNumber
sectorFound = true sectorFound = true
return false, nil return false, nil
@ -297,12 +294,10 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
return false, nil return false, nil
case builtin.MethodsMiner.ProveCommitSector: case builtin.MethodsMiner.ProveCommitSector:
log.Errorf("Look! a prove commit!")
var params miner.ProveCommitSectorParams var params miner.ProveCommitSectorParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err) return false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)
} }
log.Warn("prove commit: ", params.SectorNumber, sectorFound, sectorNumber)
if !sectorFound { if !sectorFound {
return false, nil return false, nil
@ -312,7 +307,6 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
return false, nil return false, nil
} }
log.Warn("getting out of here")
return true, nil return true, nil
default: default:
return false, nil return false, nil