Merge pull request #1394 from filecoin-project/fix/fallbackpost-finally

get fallback post running successfully!
This commit is contained in:
Whyrusleeping 2020-03-10 23:41:41 -07:00 committed by GitHub
commit d48d073bcf
4 changed files with 22 additions and 7 deletions

View File

@ -138,7 +138,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
return cid.Undef, err return cid.Undef, err
} }
params := &power.EnrollCronEventParams{ params := &power.EnrollCronEventParams{
EventEpoch: miner.ProvingPeriod, EventEpoch: miner.ProvingPeriod + power.WindowedPostChallengeDuration,
Payload: payload, Payload: payload,
} }
@ -213,6 +213,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
ActivationEpoch: 0, ActivationEpoch: 0,
DealWeight: dealWeight, DealWeight: dealWeight,
PledgeRequirement: pledge, PledgeRequirement: pledge,
DeclaredFaultEpoch: -1,
DeclaredFaultDuration: -1,
} }
err = vm.MutateState(ctx, maddr, func(cst cbor.IpldStore, st *miner.State) error { err = vm.MutateState(ctx, maddr, func(cst cbor.IpldStore, st *miner.State) error {

View File

@ -289,7 +289,6 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
} }
return st, rectroot, nil return st, rectroot, nil
} }
func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.BlockHeader, cb ExecCallback) (cid.Cid, cid.Cid, error) { func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.BlockHeader, cb ExecCallback) (cid.Cid, cid.Cid, error) {

View File

@ -173,7 +173,7 @@ var initCmd = &cli.Command{
var localPaths []config.LocalPath var localPaths []config.LocalPath
if pssb := cctx.StringSlice("pre-sealed-sectors"); len(pssb) != 0 { if pssb := cctx.StringSlice("pre-sealed-sectors"); len(pssb) != 0 {
log.Infof("Setting up storage config with presealed sector", pssb) log.Infof("Setting up storage config with presealed sector: %v", pssb)
for _, psp := range pssb { for _, psp := range pssb {
psp, err := homedir.Expand(psp) psp, err := homedir.Expand(psp)

View File

@ -1,6 +1,7 @@
package storage package storage
import ( import (
"bytes"
"context" "context"
"time" "time"
@ -147,7 +148,11 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
challengeRound := eps challengeRound := eps
rand, err := s.api.ChainGetRandomness(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, challengeRound, s.actor.Bytes()) buf := new(bytes.Buffer)
if err := s.actor.MarshalCBOR(buf); err != nil {
return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err)
}
rand, err := s.api.ChainGetRandomness(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, challengeRound, buf.Bytes())
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for fpost (ts=%d; eps=%d): %w", ts.Height(), eps, err) return nil, xerrors.Errorf("failed to get chain randomness for fpost (ts=%d; eps=%d): %w", ts.Height(), eps, err)
} }
@ -187,6 +192,15 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
return nil, xerrors.Errorf("running post failed: %w", err) return nil, xerrors.Errorf("running post failed: %w", err)
} }
if len(scandidates) == 0 {
return nil, xerrors.Errorf("received zero candidates back from generate fallback post")
}
// TODO: until we figure out how fallback post is really supposed to work,
// let's just pass a single candidate...
scandidates = scandidates[:1]
proof = proof[:1]
elapsed := time.Since(tsStart) elapsed := time.Since(tsStart)
log.Infow("submitting PoSt", "pLen", len(proof), "elapsed", elapsed) log.Infow("submitting PoSt", "pLen", len(proof), "elapsed", elapsed)