diff --git a/api/cbor_gen.go b/api/cbor_gen.go index ec5b09caf..7a3f97e59 100644 --- a/api/cbor_gen.go +++ b/api/cbor_gen.go @@ -36,7 +36,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { } // t.Channel (address.Address) (struct) - if len("Channel") > cbg.MaxLength { + if len("Channel") > 8192 { return xerrors.Errorf("Value in field \"Channel\" was too long") } @@ -52,7 +52,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { } // t.Vouchers ([]*paych.SignedVoucher) (slice) - if len("Vouchers") > cbg.MaxLength { + if len("Vouchers") > 8192 { return xerrors.Errorf("Value in field \"Vouchers\" was too long") } @@ -63,7 +63,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Vouchers) > cbg.MaxLength { + if len(t.Vouchers) > 8192 { return xerrors.Errorf("Slice value in field t.Vouchers was too long") } @@ -78,7 +78,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { } // t.WaitSentinel (cid.Cid) (struct) - if len("WaitSentinel") > cbg.MaxLength { + if len("WaitSentinel") > 8192 { return xerrors.Errorf("Value in field \"WaitSentinel\" was too long") } @@ -125,7 +125,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -152,7 +152,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -228,7 +228,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { } // t.Size (abi.UnpaddedPieceSize) (uint64) - if len("Size") > cbg.MaxLength { + if len("Size") > 8192 { return xerrors.Errorf("Value in field \"Size\" was too long") } @@ -244,7 +244,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { } // t.Offset (abi.PaddedPieceSize) (uint64) - if len("Offset") > cbg.MaxLength { + if len("Offset") > 8192 { return xerrors.Errorf("Value in field \"Offset\" was too long") } @@ -260,7 +260,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { } // t.SectorID (abi.SectorNumber) (uint64) - if len("SectorID") > cbg.MaxLength { + if len("SectorID") > 8192 { return xerrors.Errorf("Value in field \"SectorID\" was too long") } @@ -307,7 +307,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -383,7 +383,7 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error { } // t.Refs ([]api.SealedRef) (slice) - if len("Refs") > cbg.MaxLength { + if len("Refs") > 8192 { return xerrors.Errorf("Value in field \"Refs\" was too long") } @@ -394,7 +394,7 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error { return err } - if len(t.Refs) > cbg.MaxLength { + if len(t.Refs) > 8192 { return xerrors.Errorf("Slice value in field t.Refs was too long") } @@ -439,7 +439,7 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -456,7 +456,7 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Refs: array too large (%d)", extra) } @@ -509,7 +509,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { } // t.Epoch (abi.ChainEpoch) (int64) - if len("Epoch") > cbg.MaxLength { + if len("Epoch") > 8192 { return xerrors.Errorf("Value in field \"Epoch\" was too long") } @@ -531,7 +531,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { } // t.Value (abi.SealRandomness) (slice) - if len("Value") > cbg.MaxLength { + if len("Value") > 8192 { return xerrors.Errorf("Value in field \"Value\" was too long") } @@ -542,7 +542,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { return err } - if len(t.Value) > cbg.ByteArrayMaxLen { + if len(t.Value) > 2097152 { return xerrors.Errorf("Byte array in field t.Value was too long") } @@ -586,7 +586,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -599,10 +599,10 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { case "Epoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -629,7 +629,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Value: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -665,7 +665,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { } // t.Epoch (abi.ChainEpoch) (int64) - if len("Epoch") > cbg.MaxLength { + if len("Epoch") > 8192 { return xerrors.Errorf("Value in field \"Epoch\" was too long") } @@ -687,7 +687,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { } // t.Value (abi.InteractiveSealRandomness) (slice) - if len("Value") > cbg.MaxLength { + if len("Value") > 8192 { return xerrors.Errorf("Value in field \"Value\" was too long") } @@ -698,7 +698,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { return err } - if len(t.Value) > cbg.ByteArrayMaxLen { + if len(t.Value) > 2097152 { return xerrors.Errorf("Byte array in field t.Value was too long") } @@ -742,7 +742,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -755,10 +755,10 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { case "Epoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -785,7 +785,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Value: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -821,7 +821,7 @@ func (t *SectorPiece) MarshalCBOR(w io.Writer) error { } // t.Piece (abi.PieceInfo) (struct) - if len("Piece") > cbg.MaxLength { + if len("Piece") > 8192 { return xerrors.Errorf("Value in field \"Piece\" was too long") } @@ -837,7 +837,7 @@ func (t *SectorPiece) MarshalCBOR(w io.Writer) error { } // t.DealInfo (piece.PieceDealInfo) (struct) - if len("DealInfo") > cbg.MaxLength { + if len("DealInfo") > 8192 { return xerrors.Errorf("Value in field \"DealInfo\" was too long") } @@ -883,7 +883,7 @@ func (t *SectorPiece) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } diff --git a/blockstore/cbor_gen.go b/blockstore/cbor_gen.go index 063aeccae..c53e9e850 100644 --- a/blockstore/cbor_gen.go +++ b/blockstore/cbor_gen.go @@ -44,7 +44,7 @@ func (t *NetRpcReq) MarshalCBOR(w io.Writer) error { } // t.Cid ([]cid.Cid) (slice) - if len(t.Cid) > cbg.MaxLength { + if len(t.Cid) > 8192 { return xerrors.Errorf("Slice value in field t.Cid was too long") } @@ -60,7 +60,7 @@ func (t *NetRpcReq) MarshalCBOR(w io.Writer) error { } // t.Data ([][]uint8) (slice) - if len(t.Data) > cbg.MaxLength { + if len(t.Data) > 8192 { return xerrors.Errorf("Slice value in field t.Data was too long") } @@ -68,7 +68,7 @@ func (t *NetRpcReq) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Data { - if len(v) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -141,7 +141,7 @@ func (t *NetRpcReq) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Cid: array too large (%d)", extra) } @@ -182,7 +182,7 @@ func (t *NetRpcReq) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Data: array too large (%d)", extra) } @@ -208,7 +208,7 @@ func (t *NetRpcReq) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -254,7 +254,7 @@ func (t *NetRpcResp) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -326,7 +326,7 @@ func (t *NetRpcResp) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -364,7 +364,7 @@ func (t *NetRpcErr) MarshalCBOR(w io.Writer) error { } // t.Msg (string) (string) - if len(t.Msg) > cbg.MaxLength { + if len(t.Msg) > 8192 { return xerrors.Errorf("Value in field t.Msg was too long") } @@ -429,7 +429,7 @@ func (t *NetRpcErr) UnmarshalCBOR(r io.Reader) (err error) { // t.Msg (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } diff --git a/chain/exchange/cbor_gen.go b/chain/exchange/cbor_gen.go index 7d13fd336..4aa74f0c0 100644 --- a/chain/exchange/cbor_gen.go +++ b/chain/exchange/cbor_gen.go @@ -35,7 +35,7 @@ func (t *Request) MarshalCBOR(w io.Writer) error { } // t.Head ([]cid.Cid) (slice) - if len(t.Head) > cbg.MaxLength { + if len(t.Head) > 8192 { return xerrors.Errorf("Slice value in field t.Head was too long") } @@ -95,7 +95,7 @@ func (t *Request) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Head: array too large (%d)", extra) } @@ -181,7 +181,7 @@ func (t *Response) MarshalCBOR(w io.Writer) error { } // t.ErrorMessage (string) (string) - if len(t.ErrorMessage) > cbg.MaxLength { + if len(t.ErrorMessage) > 8192 { return xerrors.Errorf("Value in field t.ErrorMessage was too long") } @@ -193,7 +193,7 @@ func (t *Response) MarshalCBOR(w io.Writer) error { } // t.Chain ([]*exchange.BSTipSet) (slice) - if len(t.Chain) > cbg.MaxLength { + if len(t.Chain) > 8192 { return xerrors.Errorf("Slice value in field t.Chain was too long") } @@ -249,7 +249,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) (err error) { // t.ErrorMessage (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -263,7 +263,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Chain: array too large (%d)", extra) } @@ -337,7 +337,7 @@ func (t *CompactedMessagesCBOR) MarshalCBOR(w io.Writer) error { } // t.BlsIncludes ([]exchange.messageIndices) (slice) - if len(t.BlsIncludes) > cbg.MaxLength { + if len(t.BlsIncludes) > 8192 { return xerrors.Errorf("Slice value in field t.BlsIncludes was too long") } @@ -367,7 +367,7 @@ func (t *CompactedMessagesCBOR) MarshalCBOR(w io.Writer) error { } // t.SecpkIncludes ([]exchange.messageIndices) (slice) - if len(t.SecpkIncludes) > cbg.MaxLength { + if len(t.SecpkIncludes) > 8192 { return xerrors.Errorf("Slice value in field t.SecpkIncludes was too long") } @@ -461,7 +461,7 @@ func (t *CompactedMessagesCBOR) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.BlsIncludes: array too large (%d)", extra) } @@ -547,7 +547,7 @@ func (t *CompactedMessagesCBOR) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SecpkIncludes: array too large (%d)", extra) } @@ -596,7 +596,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { } // t.Blocks ([]*types.BlockHeader) (slice) - if len(t.Blocks) > cbg.MaxLength { + if len(t.Blocks) > 8192 { return xerrors.Errorf("Slice value in field t.Blocks was too long") } @@ -647,7 +647,7 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Blocks: array too large (%d)", extra) } diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index ba84c1e50..dde703cee 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -55,7 +55,7 @@ func (t *BlockHeader) MarshalCBOR(w io.Writer) error { } // t.BeaconEntries ([]types.BeaconEntry) (slice) - if len(t.BeaconEntries) > cbg.MaxLength { + if len(t.BeaconEntries) > 8192 { return xerrors.Errorf("Slice value in field t.BeaconEntries was too long") } @@ -70,7 +70,7 @@ func (t *BlockHeader) MarshalCBOR(w io.Writer) error { } // t.WinPoStProof ([]proof.PoStProof) (slice) - if len(t.WinPoStProof) > cbg.MaxLength { + if len(t.WinPoStProof) > 8192 { return xerrors.Errorf("Slice value in field t.WinPoStProof was too long") } @@ -85,7 +85,7 @@ func (t *BlockHeader) MarshalCBOR(w io.Writer) error { } // t.Parents ([]cid.Cid) (slice) - if len(t.Parents) > cbg.MaxLength { + if len(t.Parents) > 8192 { return xerrors.Errorf("Slice value in field t.Parents was too long") } @@ -240,7 +240,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.BeaconEntries: array too large (%d)", extra) } @@ -278,7 +278,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.WinPoStProof: array too large (%d)", extra) } @@ -316,7 +316,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Parents: array too large (%d)", extra) } @@ -362,10 +362,10 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) { // t.Height (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -513,7 +513,7 @@ func (t *Ticket) MarshalCBOR(w io.Writer) error { } // t.VRFProof ([]uint8) (slice) - if len(t.VRFProof) > cbg.ByteArrayMaxLen { + if len(t.VRFProof) > 2097152 { return xerrors.Errorf("Byte array in field t.VRFProof was too long") } @@ -558,7 +558,7 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.VRFProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -602,7 +602,7 @@ func (t *ElectionProof) MarshalCBOR(w io.Writer) error { } // t.VRFProof ([]uint8) (slice) - if len(t.VRFProof) > cbg.ByteArrayMaxLen { + if len(t.VRFProof) > 2097152 { return xerrors.Errorf("Byte array in field t.VRFProof was too long") } @@ -643,10 +643,10 @@ func (t *ElectionProof) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -672,7 +672,7 @@ func (t *ElectionProof) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.VRFProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -759,7 +759,7 @@ func (t *Message) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -855,10 +855,10 @@ func (t *Message) UnmarshalCBOR(r io.Reader) (err error) { // t.GasLimit (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -916,7 +916,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1351,7 +1351,7 @@ func (t *BlockMsg) MarshalCBOR(w io.Writer) error { } // t.BlsMessages ([]cid.Cid) (slice) - if len(t.BlsMessages) > cbg.MaxLength { + if len(t.BlsMessages) > 8192 { return xerrors.Errorf("Slice value in field t.BlsMessages was too long") } @@ -1367,7 +1367,7 @@ func (t *BlockMsg) MarshalCBOR(w io.Writer) error { } // t.SecpkMessages ([]cid.Cid) (slice) - if len(t.SecpkMessages) > cbg.MaxLength { + if len(t.SecpkMessages) > 8192 { return xerrors.Errorf("Slice value in field t.SecpkMessages was too long") } @@ -1433,7 +1433,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) } @@ -1474,7 +1474,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) } @@ -1526,7 +1526,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { } // t.Cids ([]cid.Cid) (slice) - if len(t.Cids) > cbg.MaxLength { + if len(t.Cids) > 8192 { return xerrors.Errorf("Slice value in field t.Cids was too long") } @@ -1542,7 +1542,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { } // t.Blocks ([]*types.BlockHeader) (slice) - if len(t.Blocks) > cbg.MaxLength { + if len(t.Blocks) > 8192 { return xerrors.Errorf("Slice value in field t.Blocks was too long") } @@ -1566,6 +1566,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1599,7 +1600,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Cids: array too large (%d)", extra) } @@ -1640,7 +1641,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Blocks: array too large (%d)", extra) } @@ -1684,10 +1685,10 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error) { // t.Height (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1730,7 +1731,7 @@ func (t *BeaconEntry) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -1789,7 +1790,7 @@ func (t *BeaconEntry) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1970,7 +1971,7 @@ func (t *Event) MarshalCBOR(w io.Writer) error { } // t.Entries ([]types.EventEntry) (slice) - if len(t.Entries) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -2030,7 +2031,7 @@ func (t *Event) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } @@ -2084,7 +2085,7 @@ func (t *EventEntry) MarshalCBOR(w io.Writer) error { } // t.Key (string) (string) - if len(t.Key) > cbg.MaxLength { + if len(t.Key) > 8192 { return xerrors.Errorf("Value in field t.Key was too long") } @@ -2102,7 +2103,7 @@ func (t *EventEntry) MarshalCBOR(w io.Writer) error { } // t.Value ([]uint8) (slice) - if len(t.Value) > cbg.ByteArrayMaxLen { + if len(t.Value) > 2097152 { return xerrors.Errorf("Byte array in field t.Value was too long") } @@ -2156,7 +2157,7 @@ func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error) { // t.Key (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -2184,7 +2185,7 @@ func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Value: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -2217,7 +2218,7 @@ func (t *GasTrace) MarshalCBOR(w io.Writer) error { } // t.Name (string) (string) - if len(t.Name) > cbg.MaxLength { + if len(t.Name) > 8192 { return xerrors.Errorf("Value in field t.Name was too long") } @@ -2271,6 +2272,7 @@ func (t *GasTrace) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2300,7 +2302,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.Name (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -2310,10 +2312,10 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.TotalGas (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2335,10 +2337,10 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.ComputeGas (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2360,10 +2362,10 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.StorageGas (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2385,10 +2387,10 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeTaken (time.Duration) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2522,7 +2524,7 @@ func (t *MessageTrace) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -2624,7 +2626,7 @@ func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -2713,7 +2715,7 @@ func (t *ReturnTrace) MarshalCBOR(w io.Writer) error { } // t.Return ([]uint8) (slice) - if len(t.Return) > cbg.ByteArrayMaxLen { + if len(t.Return) > 2097152 { return xerrors.Errorf("Byte array in field t.Return was too long") } @@ -2760,10 +2762,10 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) { // t.ExitCode (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2789,7 +2791,7 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Return: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/cmd/lotus-shed/shedgen/cbor_gen.go b/cmd/lotus-shed/shedgen/cbor_gen.go index af0a42fd9..10b41827f 100644 --- a/cmd/lotus-shed/shedgen/cbor_gen.go +++ b/cmd/lotus-shed/shedgen/cbor_gen.go @@ -31,7 +31,7 @@ func (t *CarbNode) MarshalCBOR(w io.Writer) error { } // t.Sub ([]cid.Cid) (slice) - if len("Sub") > cbg.MaxLength { + if len("Sub") > 8192 { return xerrors.Errorf("Value in field \"Sub\" was too long") } @@ -42,7 +42,7 @@ func (t *CarbNode) MarshalCBOR(w io.Writer) error { return err } - if len(t.Sub) > cbg.MaxLength { + if len(t.Sub) > 8192 { return xerrors.Errorf("Slice value in field t.Sub was too long") } @@ -88,7 +88,7 @@ func (t *CarbNode) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -105,7 +105,7 @@ func (t *CarbNode) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sub: array too large (%d)", extra) } diff --git a/conformance/chaos/cbor_gen.go b/conformance/chaos/cbor_gen.go index a8561163e..09d48ad10 100644 --- a/conformance/chaos/cbor_gen.go +++ b/conformance/chaos/cbor_gen.go @@ -37,7 +37,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Value (string) (string) - if len(t.Value) > cbg.MaxLength { + if len(t.Value) > 8192 { return xerrors.Errorf("Value in field t.Value was too long") } @@ -49,7 +49,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Unmarshallable ([]*chaos.UnmarshallableCBOR) (slice) - if len(t.Unmarshallable) > cbg.MaxLength { + if len(t.Unmarshallable) > 8192 { return xerrors.Errorf("Slice value in field t.Unmarshallable was too long") } @@ -91,7 +91,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Value (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -105,7 +105,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Unmarshallable: array too large (%d)", extra) } @@ -175,7 +175,7 @@ func (t *CallerValidationArgs) MarshalCBOR(w io.Writer) error { } // t.Addrs ([]address.Address) (slice) - if len(t.Addrs) > cbg.MaxLength { + if len(t.Addrs) > 8192 { return xerrors.Errorf("Slice value in field t.Addrs was too long") } @@ -190,7 +190,7 @@ func (t *CallerValidationArgs) MarshalCBOR(w io.Writer) error { } // t.Types ([]cid.Cid) (slice) - if len(t.Types) > cbg.MaxLength { + if len(t.Types) > 8192 { return xerrors.Errorf("Slice value in field t.Types was too long") } @@ -233,10 +233,10 @@ func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) (err error) { // t.Branch (chaos.CallerValidationBranch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -262,7 +262,7 @@ func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Addrs: array too large (%d)", extra) } @@ -300,7 +300,7 @@ func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Types: array too large (%d)", extra) } @@ -564,7 +564,7 @@ func (t *SendArgs) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -641,7 +641,7 @@ func (t *SendArgs) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -674,7 +674,7 @@ func (t *SendReturn) MarshalCBOR(w io.Writer) error { } // t.Return (builtin.CBORBytes) (slice) - if len(t.Return) > cbg.ByteArrayMaxLen { + if len(t.Return) > 2097152 { return xerrors.Errorf("Byte array in field t.Return was too long") } @@ -696,6 +696,7 @@ func (t *SendReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -729,7 +730,7 @@ func (t *SendReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Return: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -747,10 +748,10 @@ func (t *SendReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -787,7 +788,7 @@ func (t *MutateStateArgs) MarshalCBOR(w io.Writer) error { } // t.Value (string) (string) - if len(t.Value) > cbg.MaxLength { + if len(t.Value) > 8192 { return xerrors.Errorf("Value in field t.Value was too long") } @@ -808,6 +809,7 @@ func (t *MutateStateArgs) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -837,7 +839,7 @@ func (t *MutateStateArgs) UnmarshalCBOR(r io.Reader) (err error) { // t.Value (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -847,10 +849,10 @@ func (t *MutateStateArgs) UnmarshalCBOR(r io.Reader) (err error) { // t.Branch (chaos.MutateStateBranch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -898,7 +900,7 @@ func (t *AbortWithArgs) MarshalCBOR(w io.Writer) error { } // t.Message (string) (string) - if len(t.Message) > cbg.MaxLength { + if len(t.Message) > 8192 { return xerrors.Errorf("Value in field t.Message was too long") } @@ -942,10 +944,10 @@ func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -967,7 +969,7 @@ func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) (err error) { // t.Message (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1099,10 +1101,10 @@ func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.CurrEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/go.mod b/go.mod index 7f556551d..89d3f248a 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/filecoin-project/go-jsonrpc v0.3.1 github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.12.9-0.20240125111137-dbf4b5b126e2 + github.com/filecoin-project/go-state-types v0.12.9-0.20240208185747-90fc5ee8a28f github.com/filecoin-project/go-statemachine v1.0.3 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-storedcounter v0.1.0 @@ -145,7 +145,7 @@ require ( github.com/triplewz/poseidon v0.0.0-20220525065023-a7cdb0e183e7 github.com/urfave/cli/v2 v2.25.5 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba - github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b + github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41 github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/xeipuuv/gojsonschema v1.2.0 diff --git a/go.sum b/go.sum index c8b976710..36fd3c34e 100644 --- a/go.sum +++ b/go.sum @@ -334,8 +334,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.11.2-0.20230712101859-8f37624fa540/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8= -github.com/filecoin-project/go-state-types v0.12.9-0.20240125111137-dbf4b5b126e2 h1:kl0+C3V2skRVuCDEMLv6A0h52JudeB8S8b8DbhEH36g= -github.com/filecoin-project/go-state-types v0.12.9-0.20240125111137-dbf4b5b126e2/go.mod h1:m/6/3fAMykSC9eCWCGlwh89SN/+pDVapo+jRDov1JXk= +github.com/filecoin-project/go-state-types v0.12.9-0.20240208185747-90fc5ee8a28f h1:MU6ZfVV01kltUt/o9rFE/EJoMPH3pQVnhstOfR4BCfs= +github.com/filecoin-project/go-state-types v0.12.9-0.20240208185747-90fc5ee8a28f/go.mod h1:myupwhyuJmNaOCyodpQwutw9nWUCJ3ZtftZIzvasgag= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk= github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= @@ -1648,8 +1648,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200826160007-0b9f6c5fb163/go.mod h1:f github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b h1:+Yd0HVs6f9v2sRlpqcODhojlOd2PiBtWZTPcYmaSm5A= -github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41 h1:w7OO90SNCSrjl2mgFna9Cpx+o0wcwnRMhalfaQU/dAE= +github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= diff --git a/node/hello/cbor_gen.go b/node/hello/cbor_gen.go index dd36110d1..91a270ff7 100644 --- a/node/hello/cbor_gen.go +++ b/node/hello/cbor_gen.go @@ -35,7 +35,7 @@ func (t *HelloMessage) MarshalCBOR(w io.Writer) error { } // t.HeaviestTipSet ([]cid.Cid) (slice) - if len(t.HeaviestTipSet) > cbg.MaxLength { + if len(t.HeaviestTipSet) > 8192 { return xerrors.Errorf("Slice value in field t.HeaviestTipSet was too long") } @@ -105,7 +105,7 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.HeaviestTipSet: array too large (%d)", extra) } @@ -142,10 +142,10 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) { // t.HeaviestTipSetHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -223,6 +223,7 @@ func (t *LatencyMessage) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -252,10 +253,10 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) { // t.TArrival (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -277,10 +278,10 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) { // t.TSent (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/paychmgr/cbor_gen.go b/paychmgr/cbor_gen.go index 46a6aa6b3..3f8aaa7b5 100644 --- a/paychmgr/cbor_gen.go +++ b/paychmgr/cbor_gen.go @@ -34,7 +34,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len("Proof") > cbg.MaxLength { + if len("Proof") > 8192 { return xerrors.Errorf("Value in field \"Proof\" was too long") } @@ -45,7 +45,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Proof) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -58,7 +58,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { } // t.Voucher (paych.SignedVoucher) (struct) - if len("Voucher") > cbg.MaxLength { + if len("Voucher") > 8192 { return xerrors.Errorf("Value in field \"Voucher\" was too long") } @@ -74,7 +74,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { } // t.Submitted (bool) (bool) - if len("Submitted") > cbg.MaxLength { + if len("Submitted") > 8192 { return xerrors.Errorf("Value in field \"Submitted\" was too long") } @@ -120,7 +120,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -137,7 +137,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -212,7 +212,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Amount (big.Int) (struct) - if len("Amount") > cbg.MaxLength { + if len("Amount") > 8192 { return xerrors.Errorf("Value in field \"Amount\" was too long") } @@ -228,7 +228,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Target (address.Address) (struct) - if len("Target") > cbg.MaxLength { + if len("Target") > 8192 { return xerrors.Errorf("Value in field \"Target\" was too long") } @@ -244,7 +244,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Channel (address.Address) (struct) - if len("Channel") > cbg.MaxLength { + if len("Channel") > 8192 { return xerrors.Errorf("Value in field \"Channel\" was too long") } @@ -260,7 +260,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Control (address.Address) (struct) - if len("Control") > cbg.MaxLength { + if len("Control") > 8192 { return xerrors.Errorf("Value in field \"Control\" was too long") } @@ -276,7 +276,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.NextLane (uint64) (uint64) - if len("NextLane") > cbg.MaxLength { + if len("NextLane") > 8192 { return xerrors.Errorf("Value in field \"NextLane\" was too long") } @@ -292,7 +292,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Settling (bool) (bool) - if len("Settling") > cbg.MaxLength { + if len("Settling") > 8192 { return xerrors.Errorf("Value in field \"Settling\" was too long") } @@ -308,7 +308,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Vouchers ([]*paychmgr.VoucherInfo) (slice) - if len("Vouchers") > cbg.MaxLength { + if len("Vouchers") > 8192 { return xerrors.Errorf("Value in field \"Vouchers\" was too long") } @@ -319,7 +319,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Vouchers) > cbg.MaxLength { + if len(t.Vouchers) > 8192 { return xerrors.Errorf("Slice value in field t.Vouchers was too long") } @@ -334,7 +334,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.ChannelID (string) (string) - if len("ChannelID") > cbg.MaxLength { + if len("ChannelID") > 8192 { return xerrors.Errorf("Value in field \"ChannelID\" was too long") } @@ -345,7 +345,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.ChannelID) > cbg.MaxLength { + if len(t.ChannelID) > 8192 { return xerrors.Errorf("Value in field t.ChannelID was too long") } @@ -357,7 +357,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.CreateMsg (cid.Cid) (struct) - if len("CreateMsg") > cbg.MaxLength { + if len("CreateMsg") > 8192 { return xerrors.Errorf("Value in field \"CreateMsg\" was too long") } @@ -379,7 +379,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.Direction (uint64) (uint64) - if len("Direction") > cbg.MaxLength { + if len("Direction") > 8192 { return xerrors.Errorf("Value in field \"Direction\" was too long") } @@ -395,7 +395,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.AddFundsMsg (cid.Cid) (struct) - if len("AddFundsMsg") > cbg.MaxLength { + if len("AddFundsMsg") > 8192 { return xerrors.Errorf("Value in field \"AddFundsMsg\" was too long") } @@ -417,7 +417,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.PendingAmount (big.Int) (struct) - if len("PendingAmount") > cbg.MaxLength { + if len("PendingAmount") > 8192 { return xerrors.Errorf("Value in field \"PendingAmount\" was too long") } @@ -433,7 +433,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.AvailableAmount (big.Int) (struct) - if len("AvailableAmount") > cbg.MaxLength { + if len("AvailableAmount") > 8192 { return xerrors.Errorf("Value in field \"AvailableAmount\" was too long") } @@ -449,7 +449,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } // t.PendingAvailableAmount (big.Int) (struct) - if len("PendingAvailableAmount") > cbg.MaxLength { + if len("PendingAvailableAmount") > 8192 { return xerrors.Errorf("Value in field \"PendingAvailableAmount\" was too long") } @@ -495,7 +495,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -595,7 +595,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -640,7 +640,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { case "ChannelID": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -760,7 +760,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { } // t.Err (string) (string) - if len("Err") > cbg.MaxLength { + if len("Err") > 8192 { return xerrors.Errorf("Value in field \"Err\" was too long") } @@ -771,7 +771,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Err) > cbg.MaxLength { + if len(t.Err) > 8192 { return xerrors.Errorf("Value in field t.Err was too long") } @@ -783,7 +783,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { } // t.MsgCid (cid.Cid) (struct) - if len("MsgCid") > cbg.MaxLength { + if len("MsgCid") > 8192 { return xerrors.Errorf("Value in field \"MsgCid\" was too long") } @@ -799,7 +799,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { } // t.Received (bool) (bool) - if len("Received") > cbg.MaxLength { + if len("Received") > 8192 { return xerrors.Errorf("Value in field \"Received\" was too long") } @@ -815,7 +815,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { } // t.ChannelID (string) (string) - if len("ChannelID") > cbg.MaxLength { + if len("ChannelID") > 8192 { return xerrors.Errorf("Value in field \"ChannelID\" was too long") } @@ -826,7 +826,7 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.ChannelID) > cbg.MaxLength { + if len(t.ChannelID) > 8192 { return xerrors.Errorf("Value in field t.ChannelID was too long") } @@ -868,7 +868,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -881,7 +881,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { case "Err": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -923,7 +923,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { case "ChannelID": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } diff --git a/storage/pipeline/cbor_gen.go b/storage/pipeline/cbor_gen.go index b9c9c2a55..f32c48b4d 100644 --- a/storage/pipeline/cbor_gen.go +++ b/storage/pipeline/cbor_gen.go @@ -35,7 +35,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.Log ([]sealing.Log) (slice) - if len("Log") > cbg.MaxLength { + if len("Log") > 8192 { return xerrors.Errorf("Value in field \"Log\" was too long") } @@ -46,7 +46,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Log) > cbg.MaxLength { + if len(t.Log) > 8192 { return xerrors.Errorf("Slice value in field t.Log was too long") } @@ -61,7 +61,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CommD (cid.Cid) (struct) - if len("CommD") > cbg.MaxLength { + if len("CommD") > 8192 { return xerrors.Errorf("Value in field \"CommD\" was too long") } @@ -83,7 +83,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CommR (cid.Cid) (struct) - if len("CommR") > cbg.MaxLength { + if len("CommR") > 8192 { return xerrors.Errorf("Value in field \"CommR\" was too long") } @@ -105,7 +105,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len("Proof") > cbg.MaxLength { + if len("Proof") > 8192 { return xerrors.Errorf("Value in field \"Proof\" was too long") } @@ -116,7 +116,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Proof) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -129,7 +129,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.State (sealing.SectorState) (string) - if len("State") > cbg.MaxLength { + if len("State") > 8192 { return xerrors.Errorf("Value in field \"State\" was too long") } @@ -140,7 +140,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.State) > cbg.MaxLength { + if len(t.State) > 8192 { return xerrors.Errorf("Value in field t.State was too long") } @@ -152,7 +152,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.Pieces ([]sealing.SafeSectorPiece) (slice) - if len("Pieces") > cbg.MaxLength { + if len("Pieces") > 8192 { return xerrors.Errorf("Value in field \"Pieces\" was too long") } @@ -163,7 +163,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Pieces) > cbg.MaxLength { + if len(t.Pieces) > 8192 { return xerrors.Errorf("Slice value in field t.Pieces was too long") } @@ -178,7 +178,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.Return (sealing.ReturnState) (string) - if len("Return") > cbg.MaxLength { + if len("Return") > 8192 { return xerrors.Errorf("Value in field \"Return\" was too long") } @@ -189,7 +189,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.Return) > cbg.MaxLength { + if len(t.Return) > 8192 { return xerrors.Errorf("Value in field t.Return was too long") } @@ -201,7 +201,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.LastErr (string) (string) - if len("LastErr") > cbg.MaxLength { + if len("LastErr") > 8192 { return xerrors.Errorf("Value in field \"LastErr\" was too long") } @@ -212,7 +212,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.LastErr) > cbg.MaxLength { + if len(t.LastErr) > 8192 { return xerrors.Errorf("Value in field t.LastErr was too long") } @@ -224,7 +224,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CCPieces ([]sealing.SafeSectorPiece) (slice) - if len("CCPieces") > cbg.MaxLength { + if len("CCPieces") > 8192 { return xerrors.Errorf("Value in field \"CCPieces\" was too long") } @@ -235,7 +235,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.CCPieces) > cbg.MaxLength { + if len(t.CCPieces) > 8192 { return xerrors.Errorf("Slice value in field t.CCPieces was too long") } @@ -250,7 +250,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CCUpdate (bool) (bool) - if len("CCUpdate") > cbg.MaxLength { + if len("CCUpdate") > 8192 { return xerrors.Errorf("Value in field \"CCUpdate\" was too long") } @@ -266,7 +266,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.SeedEpoch (abi.ChainEpoch) (int64) - if len("SeedEpoch") > cbg.MaxLength { + if len("SeedEpoch") > 8192 { return xerrors.Errorf("Value in field \"SeedEpoch\" was too long") } @@ -288,7 +288,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.SeedValue (abi.InteractiveSealRandomness) (slice) - if len("SeedValue") > cbg.MaxLength { + if len("SeedValue") > 8192 { return xerrors.Errorf("Value in field \"SeedValue\" was too long") } @@ -299,7 +299,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.SeedValue) > cbg.ByteArrayMaxLen { + if len(t.SeedValue) > 2097152 { return xerrors.Errorf("Byte array in field t.SeedValue was too long") } @@ -312,7 +312,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.SectorType (abi.RegisteredSealProof) (int64) - if len("SectorType") > cbg.MaxLength { + if len("SectorType") > 8192 { return xerrors.Errorf("Value in field \"SectorType\" was too long") } @@ -334,7 +334,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.TicketEpoch (abi.ChainEpoch) (int64) - if len("TicketEpoch") > cbg.MaxLength { + if len("TicketEpoch") > 8192 { return xerrors.Errorf("Value in field \"TicketEpoch\" was too long") } @@ -356,7 +356,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.TicketValue (abi.SealRandomness) (slice) - if len("TicketValue") > cbg.MaxLength { + if len("TicketValue") > 8192 { return xerrors.Errorf("Value in field \"TicketValue\" was too long") } @@ -367,7 +367,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.TicketValue) > cbg.ByteArrayMaxLen { + if len(t.TicketValue) > 2097152 { return xerrors.Errorf("Byte array in field t.TicketValue was too long") } @@ -380,7 +380,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CreationTime (int64) (int64) - if len("CreationTime") > cbg.MaxLength { + if len("CreationTime") > 8192 { return xerrors.Errorf("Value in field \"CreationTime\" was too long") } @@ -402,7 +402,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.SectorNumber (abi.SectorNumber) (uint64) - if len("SectorNumber") > cbg.MaxLength { + if len("SectorNumber") > 8192 { return xerrors.Errorf("Value in field \"SectorNumber\" was too long") } @@ -418,7 +418,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.TerminatedAt (abi.ChainEpoch) (int64) - if len("TerminatedAt") > cbg.MaxLength { + if len("TerminatedAt") > 8192 { return xerrors.Errorf("Value in field \"TerminatedAt\" was too long") } @@ -440,7 +440,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.UpdateSealed (cid.Cid) (struct) - if len("UpdateSealed") > cbg.MaxLength { + if len("UpdateSealed") > 8192 { return xerrors.Errorf("Value in field \"UpdateSealed\" was too long") } @@ -462,7 +462,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.CommitMessage (cid.Cid) (struct) - if len("CommitMessage") > cbg.MaxLength { + if len("CommitMessage") > 8192 { return xerrors.Errorf("Value in field \"CommitMessage\" was too long") } @@ -484,7 +484,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.InvalidProofs (uint64) (uint64) - if len("InvalidProofs") > cbg.MaxLength { + if len("InvalidProofs") > 8192 { return xerrors.Errorf("Value in field \"InvalidProofs\" was too long") } @@ -500,7 +500,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommit1Out (storiface.PreCommit1Out) (slice) - if len("PreCommit1Out") > cbg.MaxLength { + if len("PreCommit1Out") > 8192 { return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long") } @@ -511,7 +511,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.PreCommit1Out) > cbg.ByteArrayMaxLen { + if len(t.PreCommit1Out) > 2097152 { return xerrors.Errorf("Byte array in field t.PreCommit1Out was too long") } @@ -524,7 +524,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.FaultReportMsg (cid.Cid) (struct) - if len("FaultReportMsg") > cbg.MaxLength { + if len("FaultReportMsg") > 8192 { return xerrors.Errorf("Value in field \"FaultReportMsg\" was too long") } @@ -546,7 +546,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.UpdateUnsealed (cid.Cid) (struct) - if len("UpdateUnsealed") > cbg.MaxLength { + if len("UpdateUnsealed") > 8192 { return xerrors.Errorf("Value in field \"UpdateUnsealed\" was too long") } @@ -568,7 +568,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommit1Fails (uint64) (uint64) - if len("PreCommit1Fails") > cbg.MaxLength { + if len("PreCommit1Fails") > 8192 { return xerrors.Errorf("Value in field \"PreCommit1Fails\" was too long") } @@ -584,7 +584,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommit2Fails (uint64) (uint64) - if len("PreCommit2Fails") > cbg.MaxLength { + if len("PreCommit2Fails") > 8192 { return xerrors.Errorf("Value in field \"PreCommit2Fails\" was too long") } @@ -600,7 +600,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommitTipSet (types.TipSetKey) (struct) - if len("PreCommitTipSet") > cbg.MaxLength { + if len("PreCommitTipSet") > 8192 { return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long") } @@ -616,7 +616,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteDataCache (storiface.SectorLocation) (struct) - if len("RemoteDataCache") > cbg.MaxLength { + if len("RemoteDataCache") > 8192 { return xerrors.Errorf("Value in field \"RemoteDataCache\" was too long") } @@ -632,7 +632,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommitDeposit (big.Int) (struct) - if len("PreCommitDeposit") > cbg.MaxLength { + if len("PreCommitDeposit") > 8192 { return xerrors.Errorf("Value in field \"PreCommitDeposit\" was too long") } @@ -648,7 +648,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.PreCommitMessage (cid.Cid) (struct) - if len("PreCommitMessage") > cbg.MaxLength { + if len("PreCommitMessage") > 8192 { return xerrors.Errorf("Value in field \"PreCommitMessage\" was too long") } @@ -670,7 +670,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteDataSealed (storiface.SectorLocation) (struct) - if len("RemoteDataSealed") > cbg.MaxLength { + if len("RemoteDataSealed") > 8192 { return xerrors.Errorf("Value in field \"RemoteDataSealed\" was too long") } @@ -686,7 +686,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.TerminateMessage (cid.Cid) (struct) - if len("TerminateMessage") > cbg.MaxLength { + if len("TerminateMessage") > 8192 { return xerrors.Errorf("Value in field \"TerminateMessage\" was too long") } @@ -708,7 +708,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteDataUnsealed (storiface.SectorLocation) (struct) - if len("RemoteDataUnsealed") > cbg.MaxLength { + if len("RemoteDataUnsealed") > 8192 { return xerrors.Errorf("Value in field \"RemoteDataUnsealed\" was too long") } @@ -724,7 +724,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) - if len("ReplicaUpdateProof") > cbg.MaxLength { + if len("ReplicaUpdateProof") > 8192 { return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long") } @@ -735,7 +735,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.ReplicaUpdateProof) > cbg.ByteArrayMaxLen { + if len(t.ReplicaUpdateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaUpdateProof was too long") } @@ -748,7 +748,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteDataFinalized (bool) (bool) - if len("RemoteDataFinalized") > cbg.MaxLength { + if len("RemoteDataFinalized") > 8192 { return xerrors.Errorf("Value in field \"RemoteDataFinalized\" was too long") } @@ -764,7 +764,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.ReplicaUpdateMessage (cid.Cid) (struct) - if len("ReplicaUpdateMessage") > cbg.MaxLength { + if len("ReplicaUpdateMessage") > 8192 { return xerrors.Errorf("Value in field \"ReplicaUpdateMessage\" was too long") } @@ -786,7 +786,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteCommit1Endpoint (string) (string) - if len("RemoteCommit1Endpoint") > cbg.MaxLength { + if len("RemoteCommit1Endpoint") > 8192 { return xerrors.Errorf("Value in field \"RemoteCommit1Endpoint\" was too long") } @@ -797,7 +797,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.RemoteCommit1Endpoint) > cbg.MaxLength { + if len(t.RemoteCommit1Endpoint) > 8192 { return xerrors.Errorf("Value in field t.RemoteCommit1Endpoint was too long") } @@ -809,7 +809,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteCommit2Endpoint (string) (string) - if len("RemoteCommit2Endpoint") > cbg.MaxLength { + if len("RemoteCommit2Endpoint") > 8192 { return xerrors.Errorf("Value in field \"RemoteCommit2Endpoint\" was too long") } @@ -820,7 +820,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.RemoteCommit2Endpoint) > cbg.MaxLength { + if len(t.RemoteCommit2Endpoint) > 8192 { return xerrors.Errorf("Value in field t.RemoteCommit2Endpoint was too long") } @@ -832,7 +832,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } // t.RemoteSealingDoneEndpoint (string) (string) - if len("RemoteSealingDoneEndpoint") > cbg.MaxLength { + if len("RemoteSealingDoneEndpoint") > 8192 { return xerrors.Errorf("Value in field \"RemoteSealingDoneEndpoint\" was too long") } @@ -843,7 +843,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - if len(t.RemoteSealingDoneEndpoint) > cbg.MaxLength { + if len(t.RemoteSealingDoneEndpoint) > 8192 { return xerrors.Errorf("Value in field t.RemoteSealingDoneEndpoint was too long") } @@ -885,7 +885,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -902,7 +902,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Log: array too large (%d)", extra) } @@ -987,7 +987,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1006,7 +1006,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "State": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1021,7 +1021,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Pieces: array too large (%d)", extra) } @@ -1056,7 +1056,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "Return": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1067,7 +1067,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "LastErr": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1082,7 +1082,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.CCPieces: array too large (%d)", extra) } @@ -1135,10 +1135,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "SeedEpoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1165,7 +1165,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SeedValue: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1184,10 +1184,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "SectorType": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1210,10 +1210,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "TicketEpoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1240,7 +1240,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.TicketValue: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1259,10 +1259,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "CreationTime": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1300,10 +1300,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "TerminatedAt": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1391,7 +1391,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PreCommit1Out: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1616,7 +1616,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaUpdateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1676,7 +1676,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "RemoteCommit1Endpoint": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1687,7 +1687,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "RemoteCommit2Endpoint": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1698,7 +1698,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case "RemoteSealingDoneEndpoint": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1727,7 +1727,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { } // t.Kind (string) (string) - if len("Kind") > cbg.MaxLength { + if len("Kind") > 8192 { return xerrors.Errorf("Value in field \"Kind\" was too long") } @@ -1738,7 +1738,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { return err } - if len(t.Kind) > cbg.MaxLength { + if len(t.Kind) > 8192 { return xerrors.Errorf("Value in field t.Kind was too long") } @@ -1750,7 +1750,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { } // t.Trace (string) (string) - if len("Trace") > cbg.MaxLength { + if len("Trace") > 8192 { return xerrors.Errorf("Value in field \"Trace\" was too long") } @@ -1761,7 +1761,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { return err } - if len(t.Trace) > cbg.MaxLength { + if len(t.Trace) > 8192 { return xerrors.Errorf("Value in field t.Trace was too long") } @@ -1773,7 +1773,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { } // t.Message (string) (string) - if len("Message") > cbg.MaxLength { + if len("Message") > 8192 { return xerrors.Errorf("Value in field \"Message\" was too long") } @@ -1784,7 +1784,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { return err } - if len(t.Message) > cbg.MaxLength { + if len(t.Message) > 8192 { return xerrors.Errorf("Value in field t.Message was too long") } @@ -1796,7 +1796,7 @@ func (t *Log) MarshalCBOR(w io.Writer) error { } // t.Timestamp (uint64) (uint64) - if len("Timestamp") > cbg.MaxLength { + if len("Timestamp") > 8192 { return xerrors.Errorf("Value in field \"Timestamp\" was too long") } @@ -1843,7 +1843,7 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1856,7 +1856,7 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { case "Kind": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1867,7 +1867,7 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { case "Trace": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1878,7 +1878,7 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { case "Message": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } diff --git a/storage/pipeline/commit_batch.go b/storage/pipeline/commit_batch.go index cd770c265..096f27e4c 100644 --- a/storage/pipeline/commit_batch.go +++ b/storage/pipeline/commit_batch.go @@ -382,15 +382,14 @@ func (b *CommitBatcher) processBatchV2(cfg sealiface.Config, sectors []abi.Secto needFunds := collateral - arp, err := b.aggregateProofType(nv) - if err != nil { - res.Error = err.Error() - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate proof type: %w", err) - } - params.AggregateProofType = arp - if aggregate { params.SectorProofs = nil // can't be set when aggregating + arp, err := b.aggregateProofType(nv) + if err != nil { + res.Error = err.Error() + return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate proof type: %w", err) + } + params.AggregateProofType = &arp mid, err := address.IDFromAddress(b.maddr) if err != nil { diff --git a/storage/pipeline/piece/cbor_gen.go b/storage/pipeline/piece/cbor_gen.go index ea085becc..ccf44e54b 100644 --- a/storage/pipeline/piece/cbor_gen.go +++ b/storage/pipeline/piece/cbor_gen.go @@ -35,7 +35,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.DealID (abi.DealID) (uint64) - if len("DealID") > cbg.MaxLength { + if len("DealID") > 8192 { return xerrors.Errorf("Value in field \"DealID\" was too long") } @@ -51,7 +51,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.PublishCid (cid.Cid) (struct) - if len("PublishCid") > cbg.MaxLength { + if len("PublishCid") > 8192 { return xerrors.Errorf("Value in field \"PublishCid\" was too long") } @@ -73,7 +73,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.DealProposal (market.DealProposal) (struct) - if len("DealProposal") > cbg.MaxLength { + if len("DealProposal") > 8192 { return xerrors.Errorf("Value in field \"DealProposal\" was too long") } @@ -89,7 +89,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.DealSchedule (piece.DealSchedule) (struct) - if len("DealSchedule") > cbg.MaxLength { + if len("DealSchedule") > 8192 { return xerrors.Errorf("Value in field \"DealSchedule\" was too long") } @@ -105,7 +105,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.KeepUnsealed (bool) (bool) - if len("KeepUnsealed") > cbg.MaxLength { + if len("KeepUnsealed") > 8192 { return xerrors.Errorf("Value in field \"KeepUnsealed\" was too long") } @@ -121,7 +121,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } // t.PieceActivationManifest (miner.PieceActivationManifest) (struct) - if len("PieceActivationManifest") > cbg.MaxLength { + if len("PieceActivationManifest") > 8192 { return xerrors.Errorf("Value in field \"PieceActivationManifest\" was too long") } @@ -167,7 +167,7 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -304,7 +304,7 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error { } // t.EndEpoch (abi.ChainEpoch) (int64) - if len("EndEpoch") > cbg.MaxLength { + if len("EndEpoch") > 8192 { return xerrors.Errorf("Value in field \"EndEpoch\" was too long") } @@ -326,7 +326,7 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error { } // t.StartEpoch (abi.ChainEpoch) (int64) - if len("StartEpoch") > cbg.MaxLength { + if len("StartEpoch") > 8192 { return xerrors.Errorf("Value in field \"StartEpoch\" was too long") } @@ -346,6 +346,7 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -378,7 +379,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -391,10 +392,10 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { case "EndEpoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -417,10 +418,10 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { case "StartEpoch": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/storage/sealer/cbor_gen.go b/storage/sealer/cbor_gen.go index 22da1b520..e4b8e644d 100644 --- a/storage/sealer/cbor_gen.go +++ b/storage/sealer/cbor_gen.go @@ -33,7 +33,7 @@ func (t *Call) MarshalCBOR(w io.Writer) error { } // t.ID (storiface.CallID) (struct) - if len("ID") > cbg.MaxLength { + if len("ID") > 8192 { return xerrors.Errorf("Value in field \"ID\" was too long") } @@ -49,7 +49,7 @@ func (t *Call) MarshalCBOR(w io.Writer) error { } // t.State (sealer.CallState) (uint64) - if len("State") > cbg.MaxLength { + if len("State") > 8192 { return xerrors.Errorf("Value in field \"State\" was too long") } @@ -65,7 +65,7 @@ func (t *Call) MarshalCBOR(w io.Writer) error { } // t.Result (sealer.ManyBytes) (struct) - if len("Result") > cbg.MaxLength { + if len("Result") > 8192 { return xerrors.Errorf("Value in field \"Result\" was too long") } @@ -81,7 +81,7 @@ func (t *Call) MarshalCBOR(w io.Writer) error { } // t.RetType (sealer.ReturnType) (string) - if len("RetType") > cbg.MaxLength { + if len("RetType") > 8192 { return xerrors.Errorf("Value in field \"RetType\" was too long") } @@ -92,7 +92,7 @@ func (t *Call) MarshalCBOR(w io.Writer) error { return err } - if len(t.RetType) > cbg.MaxLength { + if len(t.RetType) > 8192 { return xerrors.Errorf("Value in field t.RetType was too long") } @@ -134,7 +134,7 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -192,7 +192,7 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) { case "RetType": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -221,7 +221,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.ID (sealer.WorkID) (struct) - if len("ID") > cbg.MaxLength { + if len("ID") > 8192 { return xerrors.Errorf("Value in field \"ID\" was too long") } @@ -237,7 +237,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.Status (sealer.WorkStatus) (string) - if len("Status") > cbg.MaxLength { + if len("Status") > 8192 { return xerrors.Errorf("Value in field \"Status\" was too long") } @@ -248,7 +248,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { return err } - if len(t.Status) > cbg.MaxLength { + if len(t.Status) > 8192 { return xerrors.Errorf("Value in field t.Status was too long") } @@ -260,7 +260,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.StartTime (int64) (int64) - if len("StartTime") > cbg.MaxLength { + if len("StartTime") > 8192 { return xerrors.Errorf("Value in field \"StartTime\" was too long") } @@ -282,7 +282,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.WorkError (string) (string) - if len("WorkError") > cbg.MaxLength { + if len("WorkError") > 8192 { return xerrors.Errorf("Value in field \"WorkError\" was too long") } @@ -293,7 +293,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { return err } - if len(t.WorkError) > cbg.MaxLength { + if len(t.WorkError) > 8192 { return xerrors.Errorf("Value in field t.WorkError was too long") } @@ -305,7 +305,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.WorkerCall (storiface.CallID) (struct) - if len("WorkerCall") > cbg.MaxLength { + if len("WorkerCall") > 8192 { return xerrors.Errorf("Value in field \"WorkerCall\" was too long") } @@ -321,7 +321,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { } // t.WorkerHostname (string) (string) - if len("WorkerHostname") > cbg.MaxLength { + if len("WorkerHostname") > 8192 { return xerrors.Errorf("Value in field \"WorkerHostname\" was too long") } @@ -332,7 +332,7 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { return err } - if len(t.WorkerHostname) > cbg.MaxLength { + if len(t.WorkerHostname) > 8192 { return xerrors.Errorf("Value in field t.WorkerHostname was too long") } @@ -374,7 +374,7 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -397,7 +397,7 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { case "Status": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -408,10 +408,10 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { case "StartTime": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -434,7 +434,7 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { case "WorkError": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -455,7 +455,7 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { case "WorkerHostname": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -484,7 +484,7 @@ func (t *WorkID) MarshalCBOR(w io.Writer) error { } // t.Method (sealtasks.TaskType) (string) - if len("Method") > cbg.MaxLength { + if len("Method") > 8192 { return xerrors.Errorf("Value in field \"Method\" was too long") } @@ -495,7 +495,7 @@ func (t *WorkID) MarshalCBOR(w io.Writer) error { return err } - if len(t.Method) > cbg.MaxLength { + if len(t.Method) > 8192 { return xerrors.Errorf("Value in field t.Method was too long") } @@ -507,7 +507,7 @@ func (t *WorkID) MarshalCBOR(w io.Writer) error { } // t.Params (string) (string) - if len("Params") > cbg.MaxLength { + if len("Params") > 8192 { return xerrors.Errorf("Value in field \"Params\" was too long") } @@ -518,7 +518,7 @@ func (t *WorkID) MarshalCBOR(w io.Writer) error { return err } - if len(t.Params) > cbg.MaxLength { + if len(t.Params) > 8192 { return xerrors.Errorf("Value in field t.Params was too long") } @@ -560,7 +560,7 @@ func (t *WorkID) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -573,7 +573,7 @@ func (t *WorkID) UnmarshalCBOR(r io.Reader) (err error) { case "Method": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -584,7 +584,7 @@ func (t *WorkID) UnmarshalCBOR(r io.Reader) (err error) { case "Params": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } diff --git a/storage/sealer/storiface/cbor_gen.go b/storage/sealer/storiface/cbor_gen.go index 02726b5de..79d6219eb 100644 --- a/storage/sealer/storiface/cbor_gen.go +++ b/storage/sealer/storiface/cbor_gen.go @@ -31,7 +31,7 @@ func (t *CallID) MarshalCBOR(w io.Writer) error { } // t.ID (uuid.UUID) (array) - if len("ID") > cbg.MaxLength { + if len("ID") > 8192 { return xerrors.Errorf("Value in field \"ID\" was too long") } @@ -42,7 +42,7 @@ func (t *CallID) MarshalCBOR(w io.Writer) error { return err } - if len(t.ID) > cbg.ByteArrayMaxLen { + if len(t.ID) > 2097152 { return xerrors.Errorf("Byte array in field t.ID was too long") } @@ -55,7 +55,7 @@ func (t *CallID) MarshalCBOR(w io.Writer) error { } // t.Sector (abi.SectorID) (struct) - if len("Sector") > cbg.MaxLength { + if len("Sector") > 8192 { return xerrors.Errorf("Value in field \"Sector\" was too long") } @@ -101,7 +101,7 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -118,7 +118,7 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -164,7 +164,7 @@ func (t *SecDataHttpHeader) MarshalCBOR(w io.Writer) error { } // t.Key (string) (string) - if len("Key") > cbg.MaxLength { + if len("Key") > 8192 { return xerrors.Errorf("Value in field \"Key\" was too long") } @@ -175,7 +175,7 @@ func (t *SecDataHttpHeader) MarshalCBOR(w io.Writer) error { return err } - if len(t.Key) > cbg.MaxLength { + if len(t.Key) > 8192 { return xerrors.Errorf("Value in field t.Key was too long") } @@ -187,7 +187,7 @@ func (t *SecDataHttpHeader) MarshalCBOR(w io.Writer) error { } // t.Value (string) (string) - if len("Value") > cbg.MaxLength { + if len("Value") > 8192 { return xerrors.Errorf("Value in field \"Value\" was too long") } @@ -198,7 +198,7 @@ func (t *SecDataHttpHeader) MarshalCBOR(w io.Writer) error { return err } - if len(t.Value) > cbg.MaxLength { + if len(t.Value) > 8192 { return xerrors.Errorf("Value in field t.Value was too long") } @@ -240,7 +240,7 @@ func (t *SecDataHttpHeader) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -253,7 +253,7 @@ func (t *SecDataHttpHeader) UnmarshalCBOR(r io.Reader) (err error) { case "Key": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -264,7 +264,7 @@ func (t *SecDataHttpHeader) UnmarshalCBOR(r io.Reader) (err error) { case "Value": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -293,7 +293,7 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { } // t.URL (string) (string) - if len("URL") > cbg.MaxLength { + if len("URL") > 8192 { return xerrors.Errorf("Value in field \"URL\" was too long") } @@ -304,7 +304,7 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { return err } - if len(t.URL) > cbg.MaxLength { + if len(t.URL) > 8192 { return xerrors.Errorf("Value in field t.URL was too long") } @@ -316,7 +316,7 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { } // t.Local (bool) (bool) - if len("Local") > cbg.MaxLength { + if len("Local") > 8192 { return xerrors.Errorf("Value in field \"Local\" was too long") } @@ -332,7 +332,7 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { } // t.Headers ([]storiface.SecDataHttpHeader) (slice) - if len("Headers") > cbg.MaxLength { + if len("Headers") > 8192 { return xerrors.Errorf("Value in field \"Headers\" was too long") } @@ -343,7 +343,7 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { return err } - if len(t.Headers) > cbg.MaxLength { + if len(t.Headers) > 8192 { return xerrors.Errorf("Slice value in field t.Headers was too long") } @@ -388,7 +388,7 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -401,7 +401,7 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) { case "URL": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -434,7 +434,7 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Headers: array too large (%d)", extra) }