Merge pull request #253 from filecoin-project/fix/cbor-errs
use new cbor-gen code with better errors
This commit is contained in:
commit
62e596d0a3
@ -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 {
|
||||
|
@ -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 {
|
||||
|
2
go.mod
2
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
|
||||
|
4
go.sum
4
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=
|
||||
|
Loading…
Reference in New Issue
Block a user