Merge pull request #2718 from filecoin-project/schomatis/make-gen

make gen
This commit is contained in:
Łukasz Magiera 2020-07-31 13:54:09 +02:00 committed by GitHub
commit 6458354265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 57 deletions

View File

@ -33,7 +33,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Channel"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Channel"); err != nil {
if _, err := io.WriteString(w, string("Channel")); err != nil {
return err
}
@ -49,7 +49,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("ChannelMessage"))); err != nil {
return err
}
if _, err := io.WriteString(w, "ChannelMessage"); err != nil {
if _, err := io.WriteString(w, string("ChannelMessage")); err != nil {
return err
}
@ -71,7 +71,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Vouchers"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Vouchers"); err != nil {
if _, err := io.WriteString(w, string("Vouchers")); err != nil {
return err
}
@ -214,7 +214,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("SectorID"))); err != nil {
return err
}
if _, err := io.WriteString(w, "SectorID"); err != nil {
if _, err := io.WriteString(w, string("SectorID")); err != nil {
return err
}
@ -222,7 +222,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
return err
}
// t.Offset (uint64) (uint64)
// t.Offset (abi.PaddedPieceSize) (uint64)
if len("Offset") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"Offset\" was too long")
}
@ -230,7 +230,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Offset"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Offset"); err != nil {
if _, err := io.WriteString(w, string("Offset")); err != nil {
return err
}
@ -246,7 +246,7 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Size"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Size"); err != nil {
if _, err := io.WriteString(w, string("Size")); err != nil {
return err
}
@ -305,7 +305,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
t.SectorID = abi.SectorNumber(extra)
}
// t.Offset (uint64) (uint64)
// t.Offset (abi.PaddedPieceSize) (uint64)
case "Offset":
{
@ -362,7 +362,7 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Refs"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Refs"); err != nil {
if _, err := io.WriteString(w, string("Refs")); err != nil {
return err
}
@ -470,7 +470,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Value"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Value"); err != nil {
if _, err := io.WriteString(w, string("Value")); err != nil {
return err
}
@ -482,7 +482,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Value); err != nil {
if _, err := w.Write(t.Value[:]); err != nil {
return err
}
@ -494,7 +494,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Epoch"); err != nil {
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
@ -557,8 +557,12 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Value = make([]byte, extra)
if _, err := io.ReadFull(br, t.Value); err != nil {
if extra > 0 {
t.Value = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)
@ -614,7 +618,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Value"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Value"); err != nil {
if _, err := io.WriteString(w, string("Value")); err != nil {
return err
}
@ -626,7 +630,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Value); err != nil {
if _, err := w.Write(t.Value[:]); err != nil {
return err
}
@ -638,7 +642,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Epoch"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Epoch"); err != nil {
if _, err := io.WriteString(w, string("Epoch")); err != nil {
return err
}
@ -701,8 +705,12 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Value = make([]byte, extra)
if _, err := io.ReadFull(br, t.Value); err != nil {
if extra > 0 {
t.Value = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Value[:]); err != nil {
return err
}
// t.Epoch (abi.ChainEpoch) (int64)

View File

@ -9,7 +9,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
)
@ -465,7 +465,7 @@ func (t *Ticket) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.VRFProof); err != nil {
if _, err := w.Write(t.VRFProof[:]); err != nil {
return err
}
return nil
@ -502,8 +502,12 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.VRFProof = make([]byte, extra)
if _, err := io.ReadFull(br, t.VRFProof); err != nil {
if extra > 0 {
t.VRFProof = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.VRFProof[:]); err != nil {
return err
}
return nil
@ -542,7 +546,7 @@ func (t *ElectionProof) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.VRFProof); err != nil {
if _, err := w.Write(t.VRFProof[:]); err != nil {
return err
}
return nil
@ -604,8 +608,12 @@ func (t *ElectionProof) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.VRFProof = make([]byte, extra)
if _, err := io.ReadFull(br, t.VRFProof); err != nil {
if extra > 0 {
t.VRFProof = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.VRFProof[:]); err != nil {
return err
}
return nil
@ -687,7 +695,7 @@ func (t *Message) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Params); err != nil {
if _, err := w.Write(t.Params[:]); err != nil {
return err
}
return nil
@ -838,8 +846,12 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Params = make([]byte, extra)
if _, err := io.ReadFull(br, t.Params); err != nil {
if extra > 0 {
t.Params = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Params[:]); err != nil {
return err
}
return nil
@ -1119,7 +1131,7 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Return); err != nil {
if _, err := w.Write(t.Return[:]); err != nil {
return err
}
@ -1192,8 +1204,12 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Return = make([]byte, extra)
if _, err := io.ReadFull(br, t.Return); err != nil {
if extra > 0 {
t.Return = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Return[:]); err != nil {
return err
}
// t.GasUsed (int64) (int64)
@ -1555,7 +1571,7 @@ func (t *BeaconEntry) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Data); err != nil {
if _, err := w.Write(t.Data[:]); err != nil {
return err
}
return nil
@ -1606,8 +1622,12 @@ func (t *BeaconEntry) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Data = make([]byte, extra)
if _, err := io.ReadFull(br, t.Data); err != nil {
if extra > 0 {
t.Data = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Data[:]); err != nil {
return err
}
return nil

View File

@ -36,7 +36,7 @@
"Send",
"Constructor",
"AwardBlockReward",
"LastPerEpochReward",
"ThisEpochReward",
"UpdateNetworkKPI"
],
"fil/1/storagemarket": [
@ -45,7 +45,8 @@
"AddBalance",
"WithdrawBalance",
"PublishStorageDeals",
"VerifyDealsOnSectorProveCommit",
"VerifyDealsForActivation",
"ActivateDeals",
"OnMinerSectorsTerminate",
"ComputeDataCommitment",
"CronTick"
@ -68,23 +69,21 @@
"AddLockedFund",
"ReportConsensusFault",
"WithdrawBalance",
"ConfirmSectorProofsValid"
"ConfirmSectorProofsValid",
"ChangeMultiaddrs",
"CompactPartitions"
],
"fil/1/storagepower": [
"Send",
"Constructor",
"CreateMiner",
"DeleteMiner",
"OnSectorProveCommit",
"OnSectorTerminate",
"OnFaultBegin",
"OnFaultEnd",
"OnSectorModifyWeightDesc",
"UpdateClaimedPower",
"EnrollCronEvent",
"OnEpochTickEnd",
"UpdatePledgeTotal",
"OnConsensusFault",
"SubmitPoRepForBulkVerify"
"SubmitPoRepForBulkVerify",
"CurrentTotalPower"
],
"fil/1/verifiedregistry": [
"Send",

View File

@ -7,7 +7,7 @@ import (
"io"
"github.com/filecoin-project/specs-actors/actors/abi"
cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
)

View File

@ -32,7 +32,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Voucher"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Voucher"); err != nil {
if _, err := io.WriteString(w, string("Voucher")); err != nil {
return err
}
@ -48,7 +48,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Proof"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Proof"); err != nil {
if _, err := io.WriteString(w, string("Proof")); err != nil {
return err
}
@ -60,7 +60,7 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
return err
}
if _, err := w.Write(t.Proof); err != nil {
if _, err := w.Write(t.Proof[:]); err != nil {
return err
}
return nil
@ -135,8 +135,12 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Proof = make([]byte, extra)
if _, err := io.ReadFull(br, t.Proof); err != nil {
if extra > 0 {
t.Proof = make([]uint8, extra)
}
if _, err := io.ReadFull(br, t.Proof[:]); err != nil {
return err
}
@ -166,7 +170,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Channel"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Channel"); err != nil {
if _, err := io.WriteString(w, string("Channel")); err != nil {
return err
}
@ -182,7 +186,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Control"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Control"); err != nil {
if _, err := io.WriteString(w, string("Control")); err != nil {
return err
}
@ -198,7 +202,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Target"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Target"); err != nil {
if _, err := io.WriteString(w, string("Target")); err != nil {
return err
}
@ -214,7 +218,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Direction"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Direction"); err != nil {
if _, err := io.WriteString(w, string("Direction")); err != nil {
return err
}
@ -230,7 +234,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Vouchers"))); err != nil {
return err
}
if _, err := io.WriteString(w, "Vouchers"); err != nil {
if _, err := io.WriteString(w, string("Vouchers")); err != nil {
return err
}
@ -255,7 +259,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("NextLane"))); err != nil {
return err
}
if _, err := io.WriteString(w, "NextLane"); err != nil {
if _, err := io.WriteString(w, string("NextLane")); err != nil {
return err
}