Merge branch 'master' into feat/chainwatch-pg

This commit is contained in:
Łukasz Magiera 2020-01-08 18:50:58 +01:00
commit a9ca6d4065
2 changed files with 23 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import "fmt"
var CurrentCommit string var CurrentCommit string
// BuildVersion is the local build version, set by build system // BuildVersion is the local build version, set by build system
const BuildVersion = "0.1.5" const BuildVersion = "0.1.6"
var UserVersion = BuildVersion + CurrentCommit var UserVersion = BuildVersion + CurrentCommit

View File

@ -24,6 +24,7 @@ import (
) )
const MaxSectors = 1 << 48 const MaxSectors = 1 << 48
const RLEMax = 100e3
type StorageMinerActor struct{} type StorageMinerActor struct{}
@ -576,6 +577,17 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
return nil, aerrors.HandleExternalError(lerr, "could not load proving set node") return nil, aerrors.HandleExternalError(lerr, "could not load proving set node")
} }
{
c, nerr := self.FaultSet.Count()
if nerr != nil {
return nil, aerrors.Absorb(nerr, 6, "invalid bitfield")
}
if c > RLEMax {
return nil, aerrors.Newf(7, "too many items in bitfield: %d", c)
}
}
faults, nerr := self.FaultSet.AllMap() faults, nerr := self.FaultSet.AllMap()
if nerr != nil { if nerr != nil {
return nil, aerrors.Absorb(err, 5, "RLE+ invalid") return nil, aerrors.Absorb(err, 5, "RLE+ invalid")
@ -1147,6 +1159,16 @@ func onSuccessfulPoStV1(self *StorageMinerActorState, vmctx types.VMContext) aer
return aerrors.HandleExternalError(nerr, "failed to load proving set") return aerrors.HandleExternalError(nerr, "failed to load proving set")
} }
{
c, nerr := self.FaultSet.Count()
if nerr != nil {
return aerrors.Absorb(nerr, 2, "invalid bitfield")
}
if c > RLEMax {
return aerrors.Newf(3, "too many items in bitfield: %d", c)
}
}
faults, nerr := self.FaultSet.All() faults, nerr := self.FaultSet.All()
if nerr != nil { if nerr != nil {
return aerrors.Absorb(nerr, 1, "invalid bitfield (fatal?)") return aerrors.Absorb(nerr, 1, "invalid bitfield (fatal?)")