diff --git a/chain/actors/actor_miner.go b/chain/actors/actor_miner.go index a642beba0..46ab1b00e 100644 --- a/chain/actors/actor_miner.go +++ b/chain/actors/actor_miner.go @@ -228,7 +228,7 @@ func (sma StorageMinerActor) PreCommitSector(act *types.Actor, vmctx types.VMCon } if params.Epoch >= vmctx.BlockHeight() { - return nil, aerrors.New(1, "sector commitment must be based off past randomness") + return nil, aerrors.Newf(1, "sector commitment must be based off past randomness (%d >= %d)", params.Epoch, vmctx.BlockHeight()) } if vmctx.BlockHeight()-params.Epoch > 1000 { diff --git a/chain/types/tipset.go b/chain/types/tipset.go index 0939fef1c..1836fe813 100644 --- a/chain/types/tipset.go +++ b/chain/types/tipset.go @@ -9,6 +9,7 @@ import ( "github.com/ipfs/go-cid" logging "github.com/ipfs/go-log" + cbg "github.com/whyrusleeping/cbor-gen" ) var log = logging.Logger("types") @@ -52,6 +53,10 @@ func (ts *TipSet) UnmarshalJSON(b []byte) error { } func (ts *TipSet) MarshalCBOR(w io.Writer) error { + if ts == nil { + _, err := w.Write(cbg.CborNull) + return err + } return (&ExpTipSet{ Cids: ts.cids, Blocks: ts.blks, diff --git a/lib/statestore/store.go b/lib/statestore/store.go index 52734bd2b..f578c17e3 100644 --- a/lib/statestore/store.go +++ b/lib/statestore/store.go @@ -74,8 +74,8 @@ func cborMutator(mutator interface{}) func([]byte) ([]byte, error) { out := rmut.Call([]reflect.Value{state}) - if err := out[0].Interface().(error); err != nil { - return nil, err + if err := out[0].Interface(); err != nil { + return nil, err.(error) } return cborrpc.Dump(state.Interface()) diff --git a/lotuspond/front/src/StorageNode.js b/lotuspond/front/src/StorageNode.js index 741932db9..ef50c615d 100644 --- a/lotuspond/front/src/StorageNode.js +++ b/lotuspond/front/src/StorageNode.js @@ -9,12 +9,15 @@ const stateGettingToken = 'getting-token' let sealCodes = [ "Unknown", - "Pending", + "AcceptingPieces", + "Committed", + "Committing", + "CommittingPaused", "Failed", - "Sealing", - "Sealed", - "Paused", - "ReadyForSealing", + "FullyPacked", + "PreCommitted", + "PreCommitting", + "PreCommittingPaused", ] class StorageNode extends React.Component { diff --git a/storage/cbor_gen.go b/storage/cbor_gen.go index 518db6692..38e70c020 100644 --- a/storage/cbor_gen.go +++ b/storage/cbor_gen.go @@ -90,7 +90,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.State (api.SectorState) + // t.t.State (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.State)); err != nil { return err } @@ -173,7 +173,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.State (api.SectorState) + // t.t.State (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { diff --git a/storage/miner.go b/storage/miner.go index 18449a42c..4cec6c94b 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -80,6 +80,11 @@ func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datasto secst: secst, sectors: statestore.New(namespace.Wrap(ds, datastore.NewKey("/sectors"))), + + sectorIncoming: make(chan *SectorInfo), + sectorUpdated: make(chan sectorUpdate), + stop: make(chan struct{}), + stopped: make(chan struct{}), }, nil } diff --git a/storage/sealing.go b/storage/sealing.go index cb377172a..d1883be3d 100644 --- a/storage/sealing.go +++ b/storage/sealing.go @@ -81,15 +81,18 @@ func (m *Miner) onSectorIncoming(sector *SectorInfo) { } func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) { - log.Infof("Sector %s updated state to %s", update.id, api.SectorStateStr(update.newState)) + log.Infof("Sector %d updated state to %s", update.id, api.SectorStateStr(update.newState)) var sector SectorInfo err := m.sectors.Mutate(update.id, func(s *SectorInfo) error { s.State = update.newState + if update.mut != nil { + update.mut(s) + } sector = *s return nil }) if update.err != nil { - log.Errorf("deal %s failed: %s", update.id, update.err) + log.Errorf("sector %d failed: %s", update.id, update.err) m.failSector(update.id, update.err) return } @@ -111,10 +114,13 @@ func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) { } func (m *Miner) failSector(id uint64, err error) { + log.Error(err) panic(err) // todo: better error handling strategy } func (m *Miner) SealSector(ctx context.Context, sid uint64) error { + log.Infof("Begin sealing sector %d", sid) + si := &SectorInfo{ State: api.UndefinedSectorState, SectorID: sid,