actors: Remove cborgen for old types
This commit is contained in:
parent
048759a147
commit
23b662fe7d
@ -1,151 +0,0 @@
|
||||
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
|
||||
|
||||
package actors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
var _ = xerrors.Errorf
|
||||
|
||||
func (t *InitActorState) MarshalCBOR(w io.Writer) error {
|
||||
if t == nil {
|
||||
_, err := w.Write(cbg.CborNull)
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write([]byte{130}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.AddressMap (cid.Cid) (struct)
|
||||
|
||||
if err := cbg.WriteCid(w, t.AddressMap); err != nil {
|
||||
return xerrors.Errorf("failed to write cid field t.AddressMap: %w", err)
|
||||
}
|
||||
|
||||
// t.NextID (uint64) (uint64)
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *InitActorState) UnmarshalCBOR(r io.Reader) error {
|
||||
br := cbg.GetPeeker(r)
|
||||
|
||||
maj, extra, err := cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maj != cbg.MajArray {
|
||||
return fmt.Errorf("cbor input should be of type array")
|
||||
}
|
||||
|
||||
if extra != 2 {
|
||||
return fmt.Errorf("cbor input had wrong number of fields")
|
||||
}
|
||||
|
||||
// t.AddressMap (cid.Cid) (struct)
|
||||
|
||||
{
|
||||
|
||||
c, err := cbg.ReadCid(br)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to read cid field t.AddressMap: %w", err)
|
||||
}
|
||||
|
||||
t.AddressMap = c
|
||||
|
||||
}
|
||||
// t.NextID (uint64) (uint64)
|
||||
|
||||
maj, extra, err = cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maj != cbg.MajUnsignedInt {
|
||||
return fmt.Errorf("wrong type for uint64 field")
|
||||
}
|
||||
t.NextID = uint64(extra)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *ExecParams) MarshalCBOR(w io.Writer) error {
|
||||
if t == nil {
|
||||
_, err := w.Write(cbg.CborNull)
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write([]byte{130}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.Code (cid.Cid) (struct)
|
||||
|
||||
if err := cbg.WriteCid(w, t.Code); err != nil {
|
||||
return xerrors.Errorf("failed to write cid field t.Code: %w", err)
|
||||
}
|
||||
|
||||
// t.Params ([]uint8) (slice)
|
||||
if len(t.Params) > cbg.ByteArrayMaxLen {
|
||||
return xerrors.Errorf("Byte array in field t.Params was too long")
|
||||
}
|
||||
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write(t.Params); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *ExecParams) UnmarshalCBOR(r io.Reader) error {
|
||||
br := cbg.GetPeeker(r)
|
||||
|
||||
maj, extra, err := cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maj != cbg.MajArray {
|
||||
return fmt.Errorf("cbor input should be of type array")
|
||||
}
|
||||
|
||||
if extra != 2 {
|
||||
return fmt.Errorf("cbor input had wrong number of fields")
|
||||
}
|
||||
|
||||
// t.Code (cid.Cid) (struct)
|
||||
|
||||
{
|
||||
|
||||
c, err := cbg.ReadCid(br)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to read cid field t.Code: %w", err)
|
||||
}
|
||||
|
||||
t.Code = c
|
||||
|
||||
}
|
||||
// t.Params ([]uint8) (slice)
|
||||
|
||||
maj, extra, err = cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if extra > cbg.ByteArrayMaxLen {
|
||||
return fmt.Errorf("t.Params: byte array too large (%d)", extra)
|
||||
}
|
||||
if maj != cbg.MajByteString {
|
||||
return fmt.Errorf("expected byte array")
|
||||
}
|
||||
t.Params = make([]byte, extra)
|
||||
if _, err := io.ReadFull(br, t.Params); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
43
gen/main.go
43
gen/main.go
@ -7,7 +7,6 @@ import (
|
||||
gen "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/blocksync"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/statemachine"
|
||||
@ -68,48 +67,6 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = gen.WriteTupleEncodersToFile("./chain/actors/cbor_gen.go", "actors",
|
||||
actors.InitActorState{},
|
||||
actors.ExecParams{},
|
||||
actors.AccountActorState{},
|
||||
actors.StorageMinerActorState{},
|
||||
actors.StorageMinerConstructorParams{},
|
||||
actors.SectorPreCommitInfo{},
|
||||
actors.PreCommittedSector{},
|
||||
actors.MinerInfo{},
|
||||
actors.SubmitFallbackPoStParams{},
|
||||
actors.PaymentVerifyParams{},
|
||||
actors.UpdatePeerIDParams{},
|
||||
actors.DeclareFaultsParams{},
|
||||
actors.PaymentChannelActorState{},
|
||||
actors.PCAConstructorParams{},
|
||||
actors.LaneState{},
|
||||
actors.PCAUpdateChannelStateParams{},
|
||||
actors.PaymentInfo{},
|
||||
actors.StoragePowerState{},
|
||||
actors.CreateStorageMinerParams{},
|
||||
actors.IsValidMinerParam{},
|
||||
actors.PowerLookupParams{},
|
||||
actors.UpdateStorageParams{},
|
||||
actors.ArbitrateConsensusFaultParams{},
|
||||
actors.PledgeCollateralParams{},
|
||||
actors.MinerSlashConsensusFault{},
|
||||
actors.StorageMarketState{},
|
||||
actors.WithdrawBalanceParams{},
|
||||
actors.StorageDealProposal{},
|
||||
actors.PublishStorageDealsParams{},
|
||||
actors.PublishStorageDealResponse{},
|
||||
actors.ActivateStorageDealsParams{},
|
||||
actors.ComputeDataCommitmentParams{},
|
||||
actors.SectorProveCommitInfo{},
|
||||
actors.CheckMinerParams{},
|
||||
actors.CronActorState{},
|
||||
)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = gen.WriteMapEncodersToFile("./storage/sealing/cbor_gen.go", "sealing",
|
||||
sealing.SealTicket{},
|
||||
sealing.SealSeed{},
|
||||
|
Loading…
Reference in New Issue
Block a user