v25: get bench to almost work

This commit is contained in:
Łukasz Magiera 2020-04-10 14:19:06 +02:00
parent 37e7c512e6
commit b0fe8b8b4c
9 changed files with 45 additions and 35 deletions

View File

@ -90,10 +90,10 @@ func getPowerRaw(ctx context.Context, sm *StateManager, st cid.Cid, maddr addres
return big.Zero(), big.Zero(), err 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) { func GetMinerPeerID(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (peer.ID, error) {

View File

@ -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 { if err := cst.Get(ctx, act.Head, &st); err != nil {
return types.NewInt(0), xerrors.Errorf("get power actor head: %w", err) 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) log2P := int64(0)

View File

@ -37,7 +37,7 @@ type Pricelist interface {
OnHashing(dataSize int) int64 OnHashing(dataSize int) int64
OnComputeUnsealedSectorCid(proofType abi.RegisteredProof, pieces []abi.PieceInfo) int64 OnComputeUnsealedSectorCid(proofType abi.RegisteredProof, pieces []abi.PieceInfo) int64
OnVerifySeal(info abi.SealVerifyInfo) int64 OnVerifySeal(info abi.SealVerifyInfo) int64
OnVerifyPost(info abi.PoStVerifyInfo) int64 OnVerifyPost(info abi.WindowPoStVerifyInfo) int64
OnVerifyConsensusFault() int64 OnVerifyConsensusFault() int64
} }
@ -120,7 +120,7 @@ func (ps pricedSyscalls) VerifySeal(vi abi.SealVerifyInfo) error {
} }
// Verifies a proof of spacetime. // 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)) ps.chargeGas(ps.pl.OnVerifyPost(vi))
return ps.under.VerifyPoSt(vi) return ps.under.VerifyPoSt(vi)
} }

View File

@ -153,7 +153,7 @@ func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) int64 {
} }
// OnVerifyPost // 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 // TODO: this needs more cost tunning, check with @lotus
return pl.verifyPostBase return pl.verifyPostBase
} }

View File

@ -52,6 +52,10 @@ type Runtime struct {
numActorsCreated uint64 numActorsCreated uint64
} }
func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount {
panic("implement me")
}
func (rt *Runtime) ResolveAddress(addr address.Address) (ret address.Address, ok bool) { func (rt *Runtime) ResolveAddress(addr address.Address) (ret address.Address, ok bool) {
r, err := rt.state.LookupID(addr) r, err := rt.state.LookupID(addr)
if err != nil { 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()) rt.ChargeGas(rt.Pricelist().OnDeleteActor())
act, err := rt.state.GetActor(rt.Message().Receiver()) act, err := rt.state.GetActor(rt.Message().Receiver())
if err != nil { if err != nil {

View File

@ -53,8 +53,8 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte, epoch abi.ChainE
panic("NYI") panic("NYI")
} }
func (ss *syscallShim) VerifyPoSt(proof abi.PoStVerifyInfo) error { func (ss *syscallShim) VerifyPoSt(proof abi.WindowPoStVerifyInfo) error {
ok, err := ss.verifier.VerifyFallbackPost(context.TODO(), proof) ok, err := ss.verifier.VerifyWindowPoSt(context.TODO(), proof)
if err != nil { if err != nil {
return err return err
} }

View File

@ -174,14 +174,13 @@ var sealBenchCmd = &cli.Command{
} }
sectorSize := abi.SectorSize(sectorSizeInt) sectorSize := abi.SectorSize(sectorSizeInt)
ppt, spt, err := ffiwrapper.ProofTypeFromSectorSize(sectorSize) _, spt, err := ffiwrapper.ProofTypeFromSectorSize(sectorSize)
if err != nil { if err != nil {
return err return err
} }
cfg := &ffiwrapper.Config{ cfg := &ffiwrapper.Config{
SealProofType: spt, SealProofType: spt,
PoStProofType: ppt,
} }
if robench == "" { if robench == "" {
@ -196,6 +195,8 @@ var sealBenchCmd = &cli.Command{
} }
} }
panic("don")
sbfs := &basicfs.Provider{ sbfs := &basicfs.Provider{
Root: sbdir, Root: sbdir,
} }
@ -394,47 +395,42 @@ var sealBenchCmd = &cli.Command{
} }
if !c.Bool("skip-commit2") { if !c.Bool("skip-commit2") {
log.Info("generating election post candidates") log.Info("generating winning post candidates")
fcandidates, err := sb.GenerateEPostCandidates(context.TODO(), mid, sealedSectors, challenge[:], []abi.SectorNumber{}) fcandidates, err := sb.GenerateWinningPoStSectorChallenge(context.TODO(), spt, mid, challenge[:], uint64(len(sealedSectors)))
if err != nil { if err != nil {
return err return err
} }
var candidates []abi.PoStCandidate candidates := make([]abi.SectorInfo, len(fcandidates))
for _, c := range fcandidates { for i, fcandidate := range fcandidates {
c.Candidate.RegisteredProof = ppt candidates[i] = sealedSectors[i]; _ = fcandidate // todo: I have no idea what is under fcandidate, but it's a large number
candidates = append(candidates, c.Candidate)
} }
gencandidates := time.Now() gencandidates := time.Now()
log.Info("computing election post snark (cold)") log.Info("computing winning post snark (cold)")
proof1, err := sb.ComputeElectionPoSt(context.TODO(), mid, sealedSectors, challenge[:], candidates[:1]) proof1, err := sb.GenerateWinningPoSt(context.TODO(), mid, candidates, challenge[:])
if err != nil { if err != nil {
return err return err
} }
epost1 := time.Now() epost1 := time.Now()
log.Info("computing election post snark (hot)") log.Info("computing winning post snark (hot)")
proof2, err := sb.ComputeElectionPoSt(context.TODO(), mid, sealedSectors, challenge[:], candidates[:1]) proof2, err := sb.GenerateWinningPoSt(context.TODO(), mid, candidates, challenge[:])
if err != nil { if err != nil {
return err return err
} }
epost2 := time.Now() epost2 := time.Now()
ccount := ffiwrapper.ElectionPostChallengeCount(uint64(len(sealedSectors)), 0) pvi1 := abi.WinningPoStVerifyInfo{
pvi1 := abi.PoStVerifyInfo{
Randomness: abi.PoStRandomness(challenge[:]), Randomness: abi.PoStRandomness(challenge[:]),
Candidates: candidates[:1],
Proofs: proof1, Proofs: proof1,
EligibleSectors: sealedSectors, ChallengedSectors: candidates,
Prover: mid, Prover: mid,
ChallengeCount: ccount,
} }
ok, err := ffiwrapper.ProofVerifier.VerifyElectionPost(context.TODO(), pvi1) ok, err := ffiwrapper.ProofVerifier.VerifyWinningPoSt(context.TODO(), pvi1)
if err != nil { if err != nil {
return err return err
} }
@ -444,16 +440,14 @@ var sealBenchCmd = &cli.Command{
verifypost1 := time.Now() verifypost1 := time.Now()
pvi2 := abi.PoStVerifyInfo{ pvi2 := abi.WinningPoStVerifyInfo{
Randomness: abi.PoStRandomness(challenge[:]), Randomness: abi.PoStRandomness(challenge[:]),
Candidates: candidates[:1],
Proofs: proof2, Proofs: proof2,
EligibleSectors: sealedSectors, ChallengedSectors: candidates,
Prover: mid, Prover: mid,
ChallengeCount: ccount,
} }
ok, err = ffiwrapper.ProofVerifier.VerifyElectionPost(context.TODO(), pvi2) ok, err = ffiwrapper.ProofVerifier.VerifyWinningPoSt(context.TODO(), pvi2)
if err != nil { if err != nil {
return err return err
} }
@ -542,14 +536,13 @@ var proveCmd = &cli.Command{
return err return err
} }
ppt, spt, err := ffiwrapper.ProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize)) _, spt, err := ffiwrapper.ProofTypeFromSectorSize(abi.SectorSize(c2in.SectorSize))
if err != nil { if err != nil {
return err return err
} }
cfg := &ffiwrapper.Config{ cfg := &ffiwrapper.Config{
SealProofType: spt, SealProofType: spt,
PoStProofType: ppt,
} }
sb, err := ffiwrapper.New(nil, cfg) sb, err := ffiwrapper.New(nil, cfg)

4
go.mod
View File

@ -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/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/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

9
go.sum
View File

@ -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 h1:c8R11WC8m7KNMkTv/0+Be8vvwo4I3/Ut9AC2FW8fX3U=
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 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/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/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 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= 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 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 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/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/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 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= 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/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 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= 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/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= 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= 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 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54=
launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= 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=