get fallback post running successfully!

This commit is contained in:
whyrusleeping 2020-03-10 23:30:48 -07:00
parent 61e5b05262
commit 16d087cce4
4 changed files with 22 additions and 7 deletions

View File

@ -143,7 +143,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
return cid.Undef, err
}
params := &power.EnrollCronEventParams{
EventEpoch: miner.ProvingPeriod,
EventEpoch: miner.ProvingPeriod + power.WindowedPostChallengeDuration,
Payload: payload,
}
@ -208,9 +208,11 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
DealIDs: []abi.DealID{dealIDs[pi]},
Expiration: preseal.Deal.EndEpoch,
},
ActivationEpoch: 0,
DealWeight: dealWeight,
PledgeRequirement: pledge,
ActivationEpoch: 0,
DealWeight: dealWeight,
PledgeRequirement: pledge,
DeclaredFaultEpoch: -1,
DeclaredFaultDuration: -1,
}
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
}
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
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 {
psp, err := homedir.Expand(psp)

View File

@ -1,6 +1,7 @@
package storage
import (
"bytes"
"context"
"time"
@ -147,7 +148,11 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
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 {
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)
}
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)
log.Infow("submitting PoSt", "pLen", len(proof), "elapsed", elapsed)