From a2554952d14723c52aee9ec824dd1afd20f675d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 11 Apr 2020 00:20:48 +0200 Subject: [PATCH] Some electionPoSt -> winningPoSt renaming --- chain/stmgr/utils.go | 18 ------------------ chain/vm/invoker.go | 2 +- cmd/lotus-bench/main.go | 6 +++--- cmd/lotus-seal-worker/main.go | 2 +- cmd/lotus-seed/main.go | 2 +- cmd/lotus-storage-miner/init.go | 2 +- go.mod | 2 ++ node/builder.go | 2 +- storage/miner.go | 4 ++-- 9 files changed, 12 insertions(+), 28 deletions(-) diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 97c449cc9..7808faca5 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -187,24 +187,6 @@ func GetMinerSectorSet(ctx context.Context, sm *StateManager, ts *types.TipSet, return LoadSectorsFromSet(ctx, sm.ChainStore().Blockstore(), mas.Sectors) } -func GetSectorsForElectionPost(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) ([]abi.SectorInfo, error) { - sectors, err := GetMinerProvingSet(ctx, sm, ts, maddr) - if err != nil { - return nil, xerrors.Errorf("failed to get sector set for miner: %w", err) - } - - var uselessOtherArray []abi.SectorInfo - for _, s := range sectors { - uselessOtherArray = append(uselessOtherArray, abi.SectorInfo{ - RegisteredProof: s.Info.Info.RegisteredProof, - SectorNumber: s.ID, - SealedCID: s.Info.Info.SealedCID, - }) - } - - return uselessOtherArray, nil -} - func GetMinerSectorSize(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (abi.SectorSize, error) { return getMinerSectorSizeRaw(ctx, sm, ts.ParentState(), maddr) } diff --git a/chain/vm/invoker.go b/chain/vm/invoker.go index b01d4e3e6..4bc0984e1 100644 --- a/chain/vm/invoker.go +++ b/chain/vm/invoker.go @@ -77,7 +77,7 @@ func (inv *invoker) Invoke(codeCid cid.Cid, rt runtime.Runtime, method abi.Metho func (inv *invoker) Register(c cid.Cid, instance Invokee, state interface{}) { code, err := inv.transform(instance) if err != nil { - panic(err) + panic(xerrors.Errorf("%s: %w", string(c.Hash()), err)) } inv.builtInCode[c] = code inv.builtInState[c] = reflect.TypeOf(state) diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index b2e24b96a..fffdb5dd4 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -109,7 +109,7 @@ var sealBenchCmd = &cli.Command{ }, &cli.StringFlag{ Name: "benchmark-existing-sectorbuilder", - Usage: "pass a directory to run election-post timings on an existing sectorbuilder", + Usage: "pass a directory to run post timings on an existing sectorbuilder", }, &cli.BoolFlag{ Name: "json-out", @@ -174,7 +174,7 @@ var sealBenchCmd = &cli.Command{ } sectorSize := abi.SectorSize(sectorSizeInt) - _, spt, err := ffiwrapper.SealProofTypeFromSectorSize(sectorSize) + spt, err := ffiwrapper.SealProofTypeFromSectorSize(sectorSize) if err != nil { return err } @@ -535,7 +535,7 @@ var proveCmd = &cli.Command{ return err } - _, spt, err := ffiwrapper.SealProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize)) + spt, err := ffiwrapper.SealProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize)) if err != nil { return err } diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index 2f27a9f60..015490036 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -3,7 +3,6 @@ package main import ( "context" "encoding/json" - "github.com/filecoin-project/sector-storage/ffiwrapper" "io/ioutil" "net" "net/http" @@ -17,6 +16,7 @@ import ( "gopkg.in/urfave/cli.v2" paramfetch "github.com/filecoin-project/go-paramfetch" + "github.com/filecoin-project/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/apistruct" diff --git a/cmd/lotus-seed/main.go b/cmd/lotus-seed/main.go index 97bf57ac0..00406dc81 100644 --- a/cmd/lotus-seed/main.go +++ b/cmd/lotus-seed/main.go @@ -120,7 +120,7 @@ var preSealCmd = &cli.Command{ } sectorSize := abi.SectorSize(sectorSizeInt) - rp, _, err := ffiwrapper.SealProofTypeFromSectorSize(sectorSize) + rp, err := ffiwrapper.SealProofTypeFromSectorSize(sectorSize) if err != nil { return err } diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index c09522632..bb635eafb 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -447,7 +447,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode, if err != nil { return err } - epp := storage.NewElectionPoStProver(smgr, dtypes.MinerID(mid), winPt) + epp := storage.NewWinningPoStProver(smgr, dtypes.MinerID(mid), winPt) beacon := beacon.NewMockBeacon(build.BlockDelay * time.Second) diff --git a/go.mod b/go.mod index 9384e577d..1fd77a9a6 100644 --- a/go.mod +++ b/go.mod @@ -124,3 +124,5 @@ replace github.com/filecoin-project/sector-storage => /home/magik6k/gohack/githu replace github.com/filecoin-project/go-fil-markets => /home/magik6k/gohack/github.com/filecoin-project/go-fil-markets replace github.com/filecoin-project/storage-fsm => /home/magik6k/gohack/github.com/filecoin-project/storage-fsm + +replace github.com/filecoin-project/specs-actors => /home/magik6k/gohack/github.com/filecoin-project/specs-actors diff --git a/node/builder.go b/node/builder.go index 77ebb921a..5e607c114 100644 --- a/node/builder.go +++ b/node/builder.go @@ -298,7 +298,7 @@ func Online() Option { Override(HandleRetrievalKey, modules.HandleRetrieval), Override(GetParamsKey, modules.GetParams), Override(HandleDealsKey, modules.HandleDeals), - Override(new(gen.WinningPoStProver), storage.NewElectionPoStProver), + Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver), Override(new(*miner.Miner), modules.SetupBlockProducer), ), ) diff --git a/storage/miner.go b/storage/miner.go index bc22f739a..9b888d4e4 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -133,7 +133,7 @@ type StorageWpp struct { winnRpt abi.RegisteredProof } -func NewElectionPoStProver(sb storage.Prover, miner dtypes.MinerID, winnRpt abi.RegisteredProof) *StorageWpp { +func NewWinningPoStProver(sb storage.Prover, miner dtypes.MinerID, winnRpt abi.RegisteredProof) *StorageWpp { return &StorageWpp{sb, abi.ActorID(miner), winnRpt} } @@ -161,6 +161,6 @@ func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []abi.SectorInfo, r if err != nil { return nil, err } - log.Infof("ComputeElectionPost took %s", time.Since(start)) + log.Infof("GenerateWinningPoSt took %s", time.Since(start)) return proof, nil }