From f1f9ce5351904aff4995de65a049a688a9f4f96a Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Thu, 30 Jul 2020 17:25:18 -0300 Subject: [PATCH] make gen --- api/cbor_gen.go | 46 +++++++++++++---------- chain/types/cbor_gen.go | 52 ++++++++++++++++++-------- lotuspond/front/src/chain/methods.json | 19 +++++----- node/hello/cbor_gen.go | 2 +- paychmgr/cbor_gen.go | 26 +++++++------ 5 files changed, 88 insertions(+), 57 deletions(-) diff --git a/api/cbor_gen.go b/api/cbor_gen.go index 3414aaf8c92..f06ae2a0704 100644 --- a/api/cbor_gen.go +++ b/api/cbor_gen.go @@ -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) diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index 81cf0e13ee8..9f504b7c9b5 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -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 diff --git a/lotuspond/front/src/chain/methods.json b/lotuspond/front/src/chain/methods.json index 0d06587162c..9239058b9c6 100644 --- a/lotuspond/front/src/chain/methods.json +++ b/lotuspond/front/src/chain/methods.json @@ -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", diff --git a/node/hello/cbor_gen.go b/node/hello/cbor_gen.go index b9138672408..5400c3f8a61 100644 --- a/node/hello/cbor_gen.go +++ b/node/hello/cbor_gen.go @@ -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" ) diff --git a/paychmgr/cbor_gen.go b/paychmgr/cbor_gen.go index 828b0f45c17..8876f6c8ad4 100644 --- a/paychmgr/cbor_gen.go +++ b/paychmgr/cbor_gen.go @@ -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 }