2019-08-21 17:15:28 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2019-08-22 01:29:19 +00:00
|
|
|
"github.com/filecoin-project/go-lotus/chain"
|
2019-09-09 17:22:40 +00:00
|
|
|
"github.com/filecoin-project/go-lotus/chain/actors"
|
2019-08-21 17:15:28 +00:00
|
|
|
"github.com/filecoin-project/go-lotus/chain/types"
|
|
|
|
gen "github.com/whyrusleeping/cbor-gen"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-09-09 17:22:40 +00:00
|
|
|
if false {
|
2019-08-22 01:29:19 +00:00
|
|
|
fi, err := os.Create("./chain/types/cbor_gen.go")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("failed to open file: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
defer fi.Close()
|
2019-08-21 17:15:28 +00:00
|
|
|
|
2019-08-22 01:29:19 +00:00
|
|
|
if err := gen.PrintHeaderAndUtilityMethods(fi, "types"); err != nil {
|
|
|
|
fmt.Println("failed to write header: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
types := []interface{}{
|
|
|
|
types.BlockHeader{},
|
|
|
|
types.Ticket{},
|
|
|
|
types.Message{},
|
|
|
|
types.SignedMessage{},
|
|
|
|
types.MsgMeta{},
|
|
|
|
}
|
2019-08-21 17:15:28 +00:00
|
|
|
|
2019-08-22 01:29:19 +00:00
|
|
|
for _, t := range types {
|
|
|
|
if err := gen.GenTupleEncodersForType(t, fi); err != nil {
|
|
|
|
fmt.Println("failed to generate encoders: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
2019-08-21 17:15:28 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 17:22:40 +00:00
|
|
|
if false {
|
2019-08-22 01:29:19 +00:00
|
|
|
fi, err := os.Create("./chain/cbor_gen.go")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("failed to open file: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
defer fi.Close()
|
|
|
|
|
|
|
|
if err := gen.PrintHeaderAndUtilityMethods(fi, "chain"); err != nil {
|
|
|
|
fmt.Println("failed to write header: ", err)
|
2019-08-21 17:15:28 +00:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
2019-08-22 01:29:19 +00:00
|
|
|
|
|
|
|
types := []interface{}{
|
|
|
|
chain.BlockSyncRequest{},
|
|
|
|
chain.BlockSyncResponse{},
|
|
|
|
chain.BSTipSet{},
|
|
|
|
chain.BlockMsg{},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, t := range types {
|
|
|
|
if err := gen.GenTupleEncodersForType(t, fi); err != nil {
|
|
|
|
fmt.Println("failed to generate encoders: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
2019-08-21 17:15:28 +00:00
|
|
|
}
|
2019-09-09 17:22:40 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
fi, err := os.Create("./chain/actors/cbor_gen.go")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("failed to open file: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
defer fi.Close()
|
|
|
|
|
|
|
|
if err := gen.PrintHeaderAndUtilityMethods(fi, "actors"); err != nil {
|
|
|
|
fmt.Println("failed to write header: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
types := []interface{}{
|
|
|
|
actors.InitActorState{},
|
|
|
|
actors.ExecParams{},
|
|
|
|
actors.AccountActorState{},
|
|
|
|
actors.StorageMinerActorState{},
|
|
|
|
actors.StorageMinerConstructorParams{},
|
|
|
|
actors.CommitSectorParams{},
|
|
|
|
actors.MinerInfo{},
|
|
|
|
actors.SubmitPoStParams{},
|
|
|
|
actors.PieceInclVoucherData{},
|
|
|
|
actors.InclusionProof{},
|
|
|
|
actors.PaymentVerifyParams{},
|
|
|
|
actors.UpdatePeerIDParams{},
|
|
|
|
actors.MultiSigActorState{},
|
|
|
|
actors.MultiSigConstructorParams{},
|
|
|
|
actors.MultiSigProposeParams{},
|
|
|
|
actors.MultiSigTxID{},
|
|
|
|
actors.MultiSigSwapSignerParams{},
|
|
|
|
actors.MultiSigChangeReqParams{},
|
|
|
|
actors.MTransaction{},
|
|
|
|
actors.MultiSigRemoveSignerParam{},
|
|
|
|
actors.MultiSigAddSignerParam{},
|
|
|
|
actors.PaymentChannelActorState{},
|
|
|
|
actors.PCAConstructorParams{},
|
|
|
|
actors.LaneState{},
|
|
|
|
actors.PCAUpdateChannelStateParams{},
|
|
|
|
actors.PaymentInfo{},
|
|
|
|
actors.StorageMarketState{},
|
|
|
|
actors.CreateStorageMinerParams{},
|
|
|
|
actors.IsMinerParam{},
|
|
|
|
actors.PowerLookupParams{},
|
|
|
|
actors.UpdateStorageParams{},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, t := range types {
|
|
|
|
if err := gen.GenTupleEncodersForType(t, fi); err != nil {
|
|
|
|
fmt.Println("failed to generate encoders: ", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-21 17:15:28 +00:00
|
|
|
}
|