Skip to content

Commit

Permalink
fixup! Merge branch 'feat/openrpc' of github.com:etclabscore/lotus in…
Browse files Browse the repository at this point in the history
…to etclabscore-feat/openrpc
  • Loading branch information
magik6k committed Mar 19, 2021
1 parent ce27b17 commit 5e8fa31
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 38,004 deletions.
31 changes: 31 additions & 0 deletions gen/api/apistruct.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"path/filepath"
)

func genApiStruct() {
fset := token.NewFileSet()
apiDir, err := filepath.Abs("./api")
if err != nil {
fmt.Println("./api filepath absolute error: ", err)
return
}
pkgs, err := parser.ParseDir(fset, apiDir, nil, parser.AllErrors|parser.ParseComments)
if err != nil {
fmt.Println("parse error: ", err)
return
}

ap := pkgs["api"]

for fn, f := range ap.Files {
fmt.Println("F:", fn)
_= ast.NewCommentMap(fset, f, f.Comments)

}
}
107 changes: 107 additions & 0 deletions gen/cbor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package main

import (
"fmt"
"os"

gen "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/exchange"
"github.com/filecoin-project/lotus/chain/market"
"github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/node/hello"
"github.com/filecoin-project/lotus/paychmgr"
)

func main() {
err := gen.WriteTupleEncodersToFile("./chain/types/cbor_gen.go", "types",
types.BlockHeader{},
types.Ticket{},
types.ElectionProof{},
types.Message{},
types.SignedMessage{},
types.MsgMeta{},
types.Actor{},
types.MessageReceipt{},
types.BlockMsg{},
types.ExpTipSet{},
types.BeaconEntry{},
types.StateRoot{},
types.StateInfo0{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./paychmgr/cbor_gen.go", "paychmgr",
paychmgr.VoucherInfo{},
paychmgr.ChannelInfo{},
paychmgr.MsgInfo{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./api/cbor_gen.go", "api",
api.PaymentInfo{},
api.SealedRef{},
api.SealedRefs{},
api.SealTicket{},
api.SealSeed{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./node/hello/cbor_gen.go", "hello",
hello.HelloMessage{},
hello.LatencyMessage{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./chain/market/cbor_gen.go", "market",
market.FundedAddressState{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./chain/exchange/cbor_gen.go", "exchange",
exchange.Request{},
exchange.Response{},
exchange.CompactedMessages{},
exchange.BSTipSet{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./extern/sector-storage/storiface/cbor_gen.go", "storiface",
storiface.CallID{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./extern/sector-storage/cbor_gen.go", "sectorstorage",
sectorstorage.Call{},
sectorstorage.WorkState{},
sectorstorage.WorkID{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
106 changes: 0 additions & 106 deletions gen/main.go
Original file line number Diff line number Diff line change
@@ -1,107 +1 @@
package main

import (
"fmt"
"os"

gen "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/exchange"
"github.com/filecoin-project/lotus/chain/market"
"github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/node/hello"
"github.com/filecoin-project/lotus/paychmgr"
)

func main() {
err := gen.WriteTupleEncodersToFile("./chain/types/cbor_gen.go", "types",
types.BlockHeader{},
types.Ticket{},
types.ElectionProof{},
types.Message{},
types.SignedMessage{},
types.MsgMeta{},
types.Actor{},
types.MessageReceipt{},
types.BlockMsg{},
types.ExpTipSet{},
types.BeaconEntry{},
types.StateRoot{},
types.StateInfo0{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./paychmgr/cbor_gen.go", "paychmgr",
paychmgr.VoucherInfo{},
paychmgr.ChannelInfo{},
paychmgr.MsgInfo{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./api/cbor_gen.go", "api",
api.PaymentInfo{},
api.SealedRef{},
api.SealedRefs{},
api.SealTicket{},
api.SealSeed{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./node/hello/cbor_gen.go", "hello",
hello.HelloMessage{},
hello.LatencyMessage{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./chain/market/cbor_gen.go", "market",
market.FundedAddressState{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./chain/exchange/cbor_gen.go", "exchange",
exchange.Request{},
exchange.Response{},
exchange.CompactedMessages{},
exchange.BSTipSet{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./extern/sector-storage/storiface/cbor_gen.go", "storiface",
storiface.CallID{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteMapEncodersToFile("./extern/sector-storage/cbor_gen.go", "sectorstorage",
sectorstorage.Call{},
sectorstorage.WorkState{},
sectorstorage.WorkID{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
Loading

0 comments on commit 5e8fa31

Please sign in to comment.