From 74ad58881bd413627b2d6049dc7e065583131cb0 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 1 Oct 2019 09:50:13 -0600 Subject: [PATCH] use new cbor-gen code with better errors --- chain/actors/cbor_gen.go | 44 ++++++++++++++++++++-------------------- chain/types/cbor_gen.go | 26 ++++++++++++------------ go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/chain/actors/cbor_gen.go b/chain/actors/cbor_gen.go index d7dc8ad18..6fb27f0d3 100644 --- a/chain/actors/cbor_gen.go +++ b/chain/actors/cbor_gen.go @@ -136,7 +136,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Params: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -571,7 +571,7 @@ func (t *CommitSectorParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.CommD: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -588,7 +588,7 @@ func (t *CommitSectorParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.CommR: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -605,7 +605,7 @@ func (t *CommitSectorParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.CommRStar: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -622,7 +622,7 @@ func (t *CommitSectorParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Proof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -770,7 +770,7 @@ func (t *SubmitPoStParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Proof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -838,7 +838,7 @@ func (t *PieceInclVoucherData) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.CommP: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -916,7 +916,7 @@ func (t *InclusionProof) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Proof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Extra: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -995,7 +995,7 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Proof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1118,7 +1118,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Signers: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -1164,7 +1164,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Transactions: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -1234,7 +1234,7 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Signers: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -1350,7 +1350,7 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Params: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1647,7 +1647,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Params: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1664,7 +1664,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Approved: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -1894,7 +1894,7 @@ func (t *PaymentChannelActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.LaneStates (map[string]*actors.laneState) + // t.t.LaneStates (map[string]*actors.LaneState) if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.LaneStates))); err != nil { return err } @@ -1978,7 +1978,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.MinCloseHeight = extra - // t.t.LaneStates (map[string]*actors.laneState) + // t.t.LaneStates (map[string]*actors.LaneState) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1988,7 +1988,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("expected a map (major type 5)") } if extra > 4096 { - return fmt.Errorf("map too large") + return fmt.Errorf("t.LaneStates: map too large") } t.LaneStates = make(map[string]*LaneState, extra) @@ -2220,7 +2220,7 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Secret: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -2237,7 +2237,7 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Proof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -2357,7 +2357,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } if maj != cbg.MajArray { diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index be91a35c7..c19ac85ca 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -132,7 +132,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Tickets: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -158,7 +158,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.ElectionProof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -175,7 +175,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Parents: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -336,7 +336,7 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.VRFProof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -353,7 +353,7 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.VDFResult: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -370,7 +370,7 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.VDFProof: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -524,7 +524,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Params: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -756,7 +756,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.SecretPreimage: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -833,7 +833,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Merges: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -946,7 +946,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Data: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1176,7 +1176,7 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.Return: array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1277,7 +1277,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) } if maj != cbg.MajArray { @@ -1302,7 +1302,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error { return err } if extra > 8192 { - return fmt.Errorf("array too large") + return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) } if maj != cbg.MajArray { diff --git a/go.mod b/go.mod index 4c3f8afd6..2e9e01b85 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ require ( github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba - github.com/whyrusleeping/cbor-gen v0.0.0-20190917010546-c55df54645cb + github.com/whyrusleeping/cbor-gen v0.0.0-20191001154818-b4b5288fcb86 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d go.opencensus.io v0.22.0 diff --git a/go.sum b/go.sum index a4bfa81ef..65e5e9ddf 100644 --- a/go.sum +++ b/go.sum @@ -603,8 +603,8 @@ github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba h1:X4n8JG2e2 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba/go.mod h1:CHQnYnQUEPydYCwuy8lmTHfGmdw9TKrhWV0xLx8l0oM= github.com/whyrusleeping/cbor-gen v0.0.0-20190910031516-c1cbffdb01bb/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= -github.com/whyrusleeping/cbor-gen v0.0.0-20190917010546-c55df54645cb h1:Lc5MOczpVOeI/KwFoib6BMBQ1PfFxMzm/yOUfEeQP+o= -github.com/whyrusleeping/cbor-gen v0.0.0-20190917010546-c55df54645cb/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/whyrusleeping/cbor-gen v0.0.0-20191001154818-b4b5288fcb86 h1:cE8mRdI9JQAheSlIAkjJIpdAOPjYOzxSADaro6LNHnY= +github.com/whyrusleeping/cbor-gen v0.0.0-20191001154818-b4b5288fcb86/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= 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=