diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 4fd9ff024..92ad777fa 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -90,10 +90,10 @@ func getPowerRaw(ctx context.Context, sm *StateManager, st cid.Cid, maddr addres return big.Zero(), big.Zero(), err } - mpow = claim.Power + mpow = claim.QualityAdjPower // TODO: is quality adjusted power what we want here? } - return mpow, ps.TotalNetworkPower, nil + return mpow, ps.TotalQualityAdjPower, nil } func GetMinerPeerID(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (peer.ID, error) { diff --git a/chain/store/weight.go b/chain/store/weight.go index 16a833a8c..a16e2c4f2 100644 --- a/chain/store/weight.go +++ b/chain/store/weight.go @@ -44,7 +44,7 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn if err := cst.Get(ctx, act.Head, &st); err != nil { return types.NewInt(0), xerrors.Errorf("get power actor head: %w", err) } - tpow = st.TotalNetworkPower + tpow = st.TotalQualityAdjPower // TODO: REVIEW: Is this correct? } log2P := int64(0) diff --git a/chain/vm/gas.go b/chain/vm/gas.go index 109d51f12..d16839458 100644 --- a/chain/vm/gas.go +++ b/chain/vm/gas.go @@ -37,7 +37,7 @@ type Pricelist interface { OnHashing(dataSize int) int64 OnComputeUnsealedSectorCid(proofType abi.RegisteredProof, pieces []abi.PieceInfo) int64 OnVerifySeal(info abi.SealVerifyInfo) int64 - OnVerifyPost(info abi.PoStVerifyInfo) int64 + OnVerifyPost(info abi.WindowPoStVerifyInfo) int64 OnVerifyConsensusFault() int64 } @@ -120,7 +120,7 @@ func (ps pricedSyscalls) VerifySeal(vi abi.SealVerifyInfo) error { } // Verifies a proof of spacetime. -func (ps pricedSyscalls) VerifyPoSt(vi abi.PoStVerifyInfo) error { +func (ps pricedSyscalls) VerifyPoSt(vi abi.WindowPoStVerifyInfo) error { ps.chargeGas(ps.pl.OnVerifyPost(vi)) return ps.under.VerifyPoSt(vi) } diff --git a/chain/vm/gas_v0.go b/chain/vm/gas_v0.go index ae757ad5b..f51df032b 100644 --- a/chain/vm/gas_v0.go +++ b/chain/vm/gas_v0.go @@ -153,7 +153,7 @@ func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) int64 { } // OnVerifyPost -func (pl *pricelistV0) OnVerifyPost(info abi.PoStVerifyInfo) int64 { +func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) int64 { // TODO: this needs more cost tunning, check with @lotus return pl.verifyPostBase } diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index fcb8877e4..202762491 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -52,6 +52,10 @@ type Runtime struct { numActorsCreated uint64 } +func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount { + panic("implement me") +} + func (rt *Runtime) ResolveAddress(addr address.Address) (ret address.Address, ok bool) { r, err := rt.state.LookupID(addr) if err != nil { @@ -199,7 +203,7 @@ func (rt *Runtime) CreateActor(codeId cid.Cid, address address.Address) { } } -func (rt *Runtime) DeleteActor() { +func (rt *Runtime) DeleteActor(addr address.Address) { rt.ChargeGas(rt.Pricelist().OnDeleteActor()) act, err := rt.state.GetActor(rt.Message().Receiver()) if err != nil { diff --git a/chain/vm/syscalls.go b/chain/vm/syscalls.go index 53a162553..91e7e887b 100644 --- a/chain/vm/syscalls.go +++ b/chain/vm/syscalls.go @@ -53,8 +53,8 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte, epoch abi.ChainE panic("NYI") } -func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error { - ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof) +func (ss *syscallShim) VerifyPoSt(proof abi.WindowPoStVerifyInfo) error { + ok, err := ss.verifier.VerifyWindowPoSt(context.TODO(), proof) if err != nil { return err } diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index b8b317781..0ac0e4d4e 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -174,14 +174,13 @@ var sealBenchCmd = &cli.Command{ } sectorSize := abi.SectorSize(sectorSizeInt) - ppt, spt, err := ffiwrapper.ProofTypeFromSectorSize(sectorSize) + _, spt, err := ffiwrapper.ProofTypeFromSectorSize(sectorSize) if err != nil { return err } cfg := &ffiwrapper.Config{ SealProofType: spt, - PoStProofType: ppt, } if robench == "" { @@ -196,6 +195,8 @@ var sealBenchCmd = &cli.Command{ } } + panic("don") + sbfs := &basicfs.Provider{ Root: sbdir, } @@ -394,47 +395,42 @@ var sealBenchCmd = &cli.Command{ } if !c.Bool("skip-commit2") { - log.Info("generating election post candidates") - fcandidates, err := sb.GenerateEPostCandidates(context.TODO(), mid, sealedSectors, challenge[:], []abi.SectorNumber{}) + log.Info("generating winning post candidates") + fcandidates, err := sb.GenerateWinningPoStSectorChallenge(context.TODO(), spt, mid, challenge[:], uint64(len(sealedSectors))) if err != nil { return err } - var candidates []abi.PoStCandidate - for _, c := range fcandidates { - c.Candidate.RegisteredProof = ppt - candidates = append(candidates, c.Candidate) + candidates := make([]abi.SectorInfo, len(fcandidates)) + for i, fcandidate := range fcandidates { + candidates[i] = sealedSectors[i]; _ = fcandidate // todo: I have no idea what is under fcandidate, but it's a large number } gencandidates := time.Now() - log.Info("computing election post snark (cold)") - proof1, err := sb.ComputeElectionPoSt(context.TODO(), mid, sealedSectors, challenge[:], candidates[:1]) + log.Info("computing winning post snark (cold)") + proof1, err := sb.GenerateWinningPoSt(context.TODO(), mid, candidates, challenge[:]) if err != nil { return err } epost1 := time.Now() - log.Info("computing election post snark (hot)") - proof2, err := sb.ComputeElectionPoSt(context.TODO(), mid, sealedSectors, challenge[:], candidates[:1]) + log.Info("computing winning post snark (hot)") + proof2, err := sb.GenerateWinningPoSt(context.TODO(), mid, candidates, challenge[:]) if err != nil { return err } epost2 := time.Now() - ccount := ffiwrapper.ElectionPostChallengeCount(uint64(len(sealedSectors)), 0) - - pvi1 := abi.PoStVerifyInfo{ + pvi1 := abi.WinningPoStVerifyInfo{ Randomness: abi.PoStRandomness(challenge[:]), - Candidates: candidates[:1], Proofs: proof1, - EligibleSectors: sealedSectors, + ChallengedSectors: candidates, Prover: mid, - ChallengeCount: ccount, } - ok, err := ffiwrapper.ProofVerifier.VerifyElectionPost(context.TODO(), pvi1) + ok, err := ffiwrapper.ProofVerifier.VerifyWinningPoSt(context.TODO(), pvi1) if err != nil { return err } @@ -444,16 +440,14 @@ var sealBenchCmd = &cli.Command{ verifypost1 := time.Now() - pvi2 := abi.PoStVerifyInfo{ + pvi2 := abi.WinningPoStVerifyInfo{ Randomness: abi.PoStRandomness(challenge[:]), - Candidates: candidates[:1], Proofs: proof2, - EligibleSectors: sealedSectors, + ChallengedSectors: candidates, Prover: mid, - ChallengeCount: ccount, } - ok, err = ffiwrapper.ProofVerifier.VerifyElectionPost(context.TODO(), pvi2) + ok, err = ffiwrapper.ProofVerifier.VerifyWinningPoSt(context.TODO(), pvi2) if err != nil { return err } @@ -542,14 +536,13 @@ var proveCmd = &cli.Command{ return err } - ppt, spt, err := ffiwrapper.ProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize)) + _, spt, err := ffiwrapper.ProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize)) if err != nil { return err } cfg := &ffiwrapper.Config{ SealProofType: spt, - PoStProofType: ppt, } sb, err := ffiwrapper.New(nil, cfg) diff --git a/go.mod b/go.mod index 2e4b96431..c7bbf5630 100644 --- a/go.mod +++ b/go.mod @@ -115,3 +115,7 @@ replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi replace github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.0.0 + +replace github.com/filecoin-project/specs-storage => /home/magik6k/gohack/github.com/filecoin-project/specs-storage + +replace github.com/filecoin-project/sector-storage => /home/magik6k/gohack/github.com/filecoin-project/sector-storage diff --git a/go.sum b/go.sum index 34225b18d..bc3fc32a0 100644 --- a/go.sum +++ b/go.sum @@ -763,6 +763,7 @@ github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0 h1:c8R11WC8m7KNMkTv/0+Be8vvwo4I3/Ut9AC2FW8fX3U= github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -806,6 +807,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -855,6 +857,8 @@ github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1: github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8= github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= +github.com/xlab/c-for-go v0.0.0-20200116014644-76fdc4a01753/go.mod h1:IW51aYj15pzGQpgS/r4N84qI+g2fNAiTjYK5l8Gz1w0= +github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245/go.mod h1:C+diUUz7pxhNY6KAoLgrTYARGWnt82zWTylZlxT92vk= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1063,3 +1067,8 @@ howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqp howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54= launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= +modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/mathutil v1.1.0/go.mod h1:Jip3gBlE32vJMsD4RJ5qzniC0pvRnCxrlwmKPZrrLXI= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=