windowed post: Review cleanup
This commit is contained in:
parent
eba0743d47
commit
9f9ae155e3
Binary file not shown.
@ -554,31 +554,6 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round abi.ChainEpoch,
|
||||
return &types.ElectionProof{VRFProof: vrfout}, nil
|
||||
}
|
||||
|
||||
/*
|
||||
func ComputeProof(ctx context.Context, epp WinningPoStProver, pi *ProofInput) (*types.EPostProof, error) {
|
||||
proof, err := epp.ComputeProof(ctx, pi.sectors, pi.hvrf, pi.challengedSectors)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to compute snark for election proof: %w", err)
|
||||
}
|
||||
|
||||
ept := types.EPostProof{
|
||||
Proofs: proof,
|
||||
PostRand: pi.vrfout,
|
||||
}
|
||||
for _, win := range pi.challengedSectors {
|
||||
part := make([]byte, 32)
|
||||
copy(part, win.Candidate.PartialTicket)
|
||||
ept.Candidates = append(ept.Candidates, types.EPostTicket{
|
||||
Partial: part,
|
||||
SectorID: win.Candidate.SectorID.Number,
|
||||
ChallengeIndex: uint64(win.Candidate.ChallengeIndex),
|
||||
})
|
||||
}
|
||||
|
||||
return &ept, nil
|
||||
}
|
||||
*/
|
||||
|
||||
type SignFunc func(context.Context, address.Address, []byte) (*crypto.Signature, error)
|
||||
|
||||
func VerifyVRF(ctx context.Context, worker address.Address, vrfBase, vrfproof []byte) error {
|
||||
|
@ -32,6 +32,7 @@ var log = logging.Logger("genesis")
|
||||
type GenesisBootstrap struct {
|
||||
Genesis *types.BlockHeader
|
||||
}
|
||||
|
||||
/*
|
||||
From a list of parameters, create a genesis block / initial state
|
||||
|
||||
|
@ -141,16 +141,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
}
|
||||
}
|
||||
|
||||
// setup windowed post
|
||||
{
|
||||
// TODO: Can drop, now done in constructor
|
||||
err = vm.MutateState(ctx, maddr, func(cst cbor.IpldStore, st *miner.State) error {
|
||||
fmt.Println("PROVINg BOUNDARY: #### ", st.Info.ProvingPeriodBoundary)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// Commit sectors
|
||||
for pi, preseal := range m.Sectors {
|
||||
// TODO: Maybe check seal (Can just be snark inputs, doesn't go into the genesis file)
|
||||
@ -204,11 +194,11 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
RegisteredProof: preseal.ProofType,
|
||||
SectorNumber: preseal.SectorID,
|
||||
SealedCID: preseal.CommR,
|
||||
SealRandEpoch: 0, // TODO: REVIEW: Correct?
|
||||
SealRandEpoch: 0,
|
||||
DealIDs: []abi.DealID{dealIDs[pi]},
|
||||
Expiration: preseal.Deal.EndEpoch,
|
||||
},
|
||||
ActivationEpoch: 0, // TODO: REVIEW: Correct?
|
||||
ActivationEpoch: 0,
|
||||
DealWeight: dealWeight.DealWeight,
|
||||
VerifiedDealWeight: dealWeight.VerifiedDealWeight,
|
||||
}
|
||||
@ -242,7 +232,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
|
||||
c, err := vm.Flush(ctx)
|
||||
if err != nil {
|
||||
return cid.Cid{}, xerrors.Errorf("flushing vm: %w", err)
|
||||
return cid.Undef, xerrors.Errorf("flushing vm: %w", err)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ var sealBenchCmd = &cli.Command{
|
||||
Usage: "Save commit2 input to a file",
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "num-sectors",
|
||||
Name: "num-sectors",
|
||||
Value: 1,
|
||||
},
|
||||
},
|
||||
|
@ -66,6 +66,14 @@ type API struct {
|
||||
Filestore dtypes.ClientFilestore `optional:"true"`
|
||||
}
|
||||
|
||||
func calcDealExpiration(minDuration uint64, mi miner.MinerInfo, ts *types.TipSet) abi.ChainEpoch {
|
||||
// Make sure we give some time for the miner to seal
|
||||
minExp := ts.Height() + dealStartBuffer + abi.ChainEpoch(minDuration)
|
||||
|
||||
// Align on miners ProvingPeriodBoundary
|
||||
return minExp + miner.WPoStProvingPeriod - (minExp % miner.WPoStProvingPeriod) + mi.ProvingPeriodBoundary - 1
|
||||
}
|
||||
|
||||
func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) {
|
||||
exist, err := a.WalletHas(ctx, params.Wallet)
|
||||
if err != nil {
|
||||
@ -95,16 +103,13 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
||||
return nil, xerrors.Errorf("failed getting chain height: %w", err)
|
||||
}
|
||||
|
||||
exp := ts.Height() + dealStartBuffer + abi.ChainEpoch(params.MinBlocksDuration)
|
||||
exp += miner.WPoStProvingPeriod - (exp % miner.WPoStProvingPeriod) + mi.ProvingPeriodBoundary - 1
|
||||
|
||||
result, err := a.SMDealClient.ProposeStorageDeal(
|
||||
ctx,
|
||||
params.Wallet,
|
||||
&providerInfo,
|
||||
params.Data,
|
||||
ts.Height()+dealStartBuffer,
|
||||
exp,
|
||||
calcDealExpiration(params.MinBlocksDuration, mi, ts),
|
||||
params.EpochPrice,
|
||||
big.Zero(),
|
||||
rt,
|
||||
|
@ -57,10 +57,6 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *miner.Deadli
|
||||
func (s *WindowPoStScheduler) checkFaults(ctx context.Context, ssi []abi.SectorNumber) ([]abi.SectorNumber, error) {
|
||||
//faults := s.prover.Scrub(ssi)
|
||||
log.Warnf("Stub checkFaults")
|
||||
var faults []struct {
|
||||
SectorNum abi.SectorNumber
|
||||
Err error
|
||||
}
|
||||
|
||||
declaredFaults := map[abi.SectorNumber]struct{}{}
|
||||
|
||||
@ -75,12 +71,7 @@ func (s *WindowPoStScheduler) checkFaults(ctx context.Context, ssi []abi.SectorN
|
||||
}
|
||||
}
|
||||
|
||||
var faultIDs []abi.SectorNumber
|
||||
if len(faults) > 0 {
|
||||
panic("Aaaaaaaaaaaaaaaaaaaa")
|
||||
}
|
||||
|
||||
return faultIDs, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo, ts *types.TipSet) (*miner.SubmitWindowedPoStParams, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user