-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Merge branch 'feat/openrpc' of github.com:etclabscore/lotus in…
…to etclabscore-feat/openrpc
- Loading branch information
Showing
5 changed files
with
138 additions
and
38,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
Oops, something went wrong.