From ea58bee3f59b12654ed8d3373f94b16d74ea74ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 11 Mar 2021 12:03:24 +0100 Subject: [PATCH] backupds: Allow larger values in write log --- gen/main.go | 9 --------- lib/backupds/{cbor_gen.go => cbor.go} | 25 ------------------------- 2 files changed, 34 deletions(-) rename lib/backupds/{cbor_gen.go => cbor.go} (79%) diff --git a/gen/main.go b/gen/main.go index 61f41beec..9548344fd 100644 --- a/gen/main.go +++ b/gen/main.go @@ -12,7 +12,6 @@ import ( "github.com/filecoin-project/lotus/chain/types" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - "github.com/filecoin-project/lotus/lib/backupds" "github.com/filecoin-project/lotus/node/hello" "github.com/filecoin-project/lotus/paychmgr" ) @@ -105,12 +104,4 @@ func main() { fmt.Println(err) os.Exit(1) } - - err = gen.WriteTupleEncodersToFile("./lib/backupds/cbor_gen.go", "backupds", - backupds.Entry{}, - ) - if err != nil { - fmt.Println(err) - os.Exit(1) - } } diff --git a/lib/backupds/cbor_gen.go b/lib/backupds/cbor.go similarity index 79% rename from lib/backupds/cbor_gen.go rename to lib/backupds/cbor.go index d6cb6f4d3..09e0058fe 100644 --- a/lib/backupds/cbor_gen.go +++ b/lib/backupds/cbor.go @@ -1,21 +1,12 @@ -// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT. - package backupds import ( "fmt" "io" - "sort" - cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" - xerrors "golang.org/x/xerrors" ) -var _ = xerrors.Errorf -var _ = cid.Undef -var _ = sort.Sort - var lengthBufEntry = []byte{131} func (t *Entry) MarshalCBOR(w io.Writer) error { @@ -29,11 +20,6 @@ func (t *Entry) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) - // t.Key ([]uint8) (slice) - if len(t.Key) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Key was too long") - } - if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajByteString, uint64(len(t.Key))); err != nil { return err } @@ -42,11 +28,6 @@ func (t *Entry) MarshalCBOR(w io.Writer) error { return err } - // t.Value ([]uint8) (slice) - if len(t.Value) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Value was too long") - } - if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajByteString, uint64(len(t.Value))); err != nil { return err } @@ -93,9 +74,6 @@ func (t *Entry) UnmarshalCBOR(r io.Reader) error { return err } - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Key: byte array too large (%d)", extra) - } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -114,9 +92,6 @@ func (t *Entry) UnmarshalCBOR(r io.Reader) error { return err } - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Value: byte array too large (%d)", extra) - } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") }