post: Address review

This commit is contained in:
Łukasz Magiera 2019-09-19 22:24:01 +02:00
parent fdb45aeeaa
commit 5fd98b7d27
4 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@ type StorageMinerActorState struct {
DePledgeTime types.BigInt DePledgeTime types.BigInt
// All sectors this miner has committed. // All sectors this miner has committed.
Sectors cid.Cid // TODO: Using a HAMT for now, needs to be an AMT once we implement it Sectors cid.Cid
// Sectors this miner is currently mining. It is only updated // Sectors this miner is currently mining. It is only updated
// when a PoSt is submitted (not as each new sector commitment is added). // when a PoSt is submitted (not as each new sector commitment is added).
@ -295,7 +295,7 @@ type SubmitPoStParams struct {
// TODO: this is a dummy method that allows us to plumb in other parts of the // TODO: this is a dummy method that allows us to plumb in other parts of the
// system for now. // system for now.
func (sma StorageMinerActor) SubmitPoSt(act *types.Actor, vmctx types.VMContext, params *SubmitPoStParams) (_ []byte, paerr ActorError) { func (sma StorageMinerActor) SubmitPoSt(act *types.Actor, vmctx types.VMContext, params *SubmitPoStParams) ([]byte, ActorError) {
oldstate, self, err := loadState(vmctx) oldstate, self, err := loadState(vmctx)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -107,7 +107,10 @@ func (bi *BigInt) MarshalCBOR(w io.Writer) error {
return zero.MarshalCBOR(w) return zero.MarshalCBOR(w)
} }
tag := uint64(^(bi.Sign()|1)+6) >> 1 tag := uint64(2)
if bi.Sign() < 0 {
tag = 3
}
header := cbg.CborEncodeMajorType(cbg.MajTag, tag) header := cbg.CborEncodeMajorType(cbg.MajTag, tag)
if _, err := w.Write(header); err != nil { if _, err := w.Write(header); err != nil {

View File

@ -70,6 +70,10 @@ func (vmc *VMContext) GetRandomness(height uint64) ([]byte, aerrors.ActorError)
hts := vmc.vm.cs.GetHeaviestTipSet() hts := vmc.vm.cs.GetHeaviestTipSet()
relHeight := int(hts.Height() - height) relHeight := int(hts.Height() - height)
if relHeight < 0 {
return nil, aerrors.Newf(1, "negative relHeight in GetRandomness: %d", relHeight)
}
res, err := vmc.vm.cs.GetRandomness(vmc.ctx, hts, nil, relHeight) res, err := vmc.vm.cs.GetRandomness(vmc.ctx, hts, nil, relHeight)
if err != nil { if err != nil {
return nil, aerrors.Escalate(err, "could not get randomness") return nil, aerrors.Escalate(err, "could not get randomness")