miner actor: Change PPE logic in submitPost
This commit is contained in:
parent
a167b9f5db
commit
4305824be7
@ -312,16 +312,14 @@ func (sma StorageMinerActor) SubmitPoSt(act *types.Actor, vmctx types.VMContext,
|
|||||||
return nil, aerrors.New(1, "not authorized to submit post for miner")
|
return nil, aerrors.New(1, "not authorized to submit post for miner")
|
||||||
}
|
}
|
||||||
|
|
||||||
feesRequired := types.NewInt(0)
|
provingPeriodOffset := self.ProvingPeriodEnd % build.ProvingPeriodDuration
|
||||||
nextProvingPeriodEnd := self.ProvingPeriodEnd + build.ProvingPeriodDuration
|
provingPeriod := (vmctx.BlockHeight() - provingPeriodOffset - 1) / build.ProvingPeriodDuration + 1
|
||||||
if vmctx.BlockHeight() > nextProvingPeriodEnd {
|
currentProvingPeriodEnd := provingPeriod * build.ProvingPeriodDuration + provingPeriodOffset
|
||||||
return nil, aerrors.New(1, "PoSt submited too late")
|
|
||||||
}
|
|
||||||
|
|
||||||
var lateSubmission bool
|
feesRequired := types.NewInt(0)
|
||||||
if vmctx.BlockHeight() > self.ProvingPeriodEnd {
|
|
||||||
|
if currentProvingPeriodEnd > self.ProvingPeriodEnd {
|
||||||
//TODO late fee calc
|
//TODO late fee calc
|
||||||
lateSubmission = true
|
|
||||||
feesRequired = types.BigAdd(feesRequired, types.NewInt(1000))
|
feesRequired = types.BigAdd(feesRequired, types.NewInt(1000))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,13 +340,14 @@ func (sma StorageMinerActor) SubmitPoSt(act *types.Actor, vmctx types.VMContext,
|
|||||||
|
|
||||||
var seed [sectorbuilder.CommLen]byte
|
var seed [sectorbuilder.CommLen]byte
|
||||||
{
|
{
|
||||||
var rand []byte
|
randHeight := currentProvingPeriodEnd - build.PoSTChallangeTime
|
||||||
var err ActorError
|
if vmctx.BlockHeight() <= randHeight {
|
||||||
if !lateSubmission {
|
// TODO: spec, retcode
|
||||||
rand, err = vmctx.GetRandomness(self.ProvingPeriodEnd - build.PoSTChallangeTime)
|
return nil, aerrors.New(1, "submit PoSt called outside submission window")
|
||||||
} else {
|
|
||||||
rand, err = vmctx.GetRandomness(nextProvingPeriodEnd - build.PoSTChallangeTime)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rand, err := vmctx.GetRandomness(randHeight)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, aerrors.Wrap(err, "could not get randomness for PoST")
|
return nil, aerrors.Wrap(err, "could not get randomness for PoST")
|
||||||
}
|
}
|
||||||
@ -434,7 +433,7 @@ func (sma StorageMinerActor) SubmitPoSt(act *types.Actor, vmctx types.VMContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.ProvingSet = self.Sectors
|
self.ProvingSet = self.Sectors
|
||||||
self.ProvingPeriodEnd = nextProvingPeriodEnd
|
self.ProvingPeriodEnd = currentProvingPeriodEnd + build.ProvingPeriodDuration
|
||||||
self.NextDoneSet = params.DoneSet
|
self.NextDoneSet = params.DoneSet
|
||||||
|
|
||||||
c, err := vmctx.Storage().Put(self)
|
c, err := vmctx.Storage().Put(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user