diff --git a/cbor_gen.go b/cbor_gen.go index e13bcf43a..f83d35990 100644 --- a/cbor_gen.go +++ b/cbor_gen.go @@ -980,7 +980,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{165}); err != nil { + if _, err := w.Write([]byte{164}); err != nil { return err } @@ -1068,29 +1068,6 @@ func (t *Log) MarshalCBOR(w io.Writer) error { if _, err := w.Write([]byte(t.Kind)); err != nil { return err } - - // t.Params ([]uint8) (slice) - if len("Params") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Params\" was too long") - } - - if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Params")))); err != nil { - return err - } - if _, err := w.Write([]byte("Params")); err != nil { - return err - } - - if len(t.Params) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Params was too long") - } - - if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil { - return err - } - if _, err := w.Write(t.Params); err != nil { - return err - } return nil } @@ -1168,24 +1145,6 @@ func (t *Log) UnmarshalCBOR(r io.Reader) error { t.Kind = string(sval) } - // t.Params ([]uint8) (slice) - case "Params": - - maj, extra, err = cbg.CborReadHeader(br) - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Params: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - t.Params = make([]byte, extra) - if _, err := io.ReadFull(br, t.Params); err != nil { - return err - } default: return fmt.Errorf("unknown struct field %d: '%s'", i, name) diff --git a/fsm.go b/fsm.go index ba2702696..fced052aa 100644 --- a/fsm.go +++ b/fsm.go @@ -2,7 +2,9 @@ package sealing import ( "context" + "fmt" "reflect" + "time" "golang.org/x/xerrors" @@ -66,6 +68,20 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta ///// // First process all events + for _, event := range events { + l := Log{ + Timestamp: uint64(time.Now().Unix()), + Message: fmt.Sprintf("%+v", event), + Kind: fmt.Sprintf("event;%T", event.User), + } + + if err, iserr := event.User.(xerrors.Formatter); iserr { + l.Trace = fmt.Sprintf("%+v", err) + } + + state.Log = append(state.Log, l) + } + p := fsmPlanners[state.State] if p == nil { return nil, xerrors.Errorf("planner for state %d not found", state.State) diff --git a/types.go b/types.go index ae8d7ac23..952c5ec22 100644 --- a/types.go +++ b/types.go @@ -53,7 +53,6 @@ type Log struct { // additional data (Event info) Kind string - Params []byte } type SectorInfo struct {