lotus/go.mod
Łukasz Magiera 43d9cc36a4
OpenRPC Support (#5843)
* main: init implement rpc.Discover RPC method

This implement the basic functionality for the method
over HTTP RPC.

Signed-off-by: meows <b5c6@protonmail.com>

* main,go.mod,go.sum: init example with go-openrpc-reflect lib

Signed-off-by: meows <b5c6@protonmail.com>

 Conflicts:
	go.mod
	go.sum

* main: make variable name human-friendly

Signed-off-by: meows <b5c6@protonmail.com>

* main,go.mod,go.sum: init impl of go-openrp-reflect printing document

Signed-off-by: meows <b5c6@protonmail.com>

 Conflicts:
	go.mod
	go.sum

* go.mod,go.sum: use go-openrpc-reflect and open-rpc/meta-schema hackforks

This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.

Signed-off-by: meows <b5c6@protonmail.com>

* main,openrpc,main: refactor openrpc supporting code to own package

This eliminates code duplication.

Signed-off-by: meows <b5c6@protonmail.com>

* main: add rpc.Discover to openrpc document

Signed-off-by: meows <b5c6@protonmail.com>

* openrpc: fix rpc.discover method name casing

Also fixes casing stuff for the rest of Filecoin.
methods.

Signed-off-by: meows <b5c6@protonmail.com>

* Revert "main: add rpc.Discover to openrpc document"

This reverts commit 116898efb10f33e405ac74acb1aa6daefcd46a62.

* main: fix document creation method name

This fixes an issue caused with the latest reverting
commit.

Signed-off-by: meows <b5c6@protonmail.com>

* main,docgen,openrpc: refactor to share api parsing, etc as docgen exported stuff

Signed-off-by: meows <b5c6@protonmail.com>

Makefile: fix docgen refactoring for makefile use of command

Signed-off-by: meows <b5c6@protonmail.com>

* openrpc: add schema.examples to app reflector

There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!

Signed-off-by: meows <b5c6@protonmail.com>

* openrpc: init method pairing examples

Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: bump go.mod to use latest meta-schema and openrpc-reflect versions

Signed-off-by: meows <b5c6@protonmail.com>

* openrpc: init SchemaType mapper function

This function will handle the manual configurations
for app-specific data types w/r/t their json schema
representation.

This is useful for cases where the reflect library
is unable to provide a sufficient representation
automatically.

Provided in this commit is an initial implementation
for the integerD type (assuming number are represented
in the API as hexs), and a commonly used cid.Cid type.

Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: tame dependencies by bumping etclabscore/go-openrpc-reflect

This removes a problematic dependency
on github.com/ethereum/go-ethereum, which was
imported as a dependency for a couple github.com/etclabscore/go-openrpc-reflect
tests.

etclabscore/go-openrpc-reflect v0.0.36 has removed this
dependency, so this commit is the result of bumping
that version and then running 'go mod tidy'

This is in response to a review at
https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205

Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main: add 'miner' arg to openrpc gen cmd

This allows the command to EITHER
generate the doc for Full or Miner APIs.

See comment for usage.

Date: 2020-11-21 07:48:05-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* docgen: add missing examples for Miner API

Generating the Miner API OpenRPC doc
(via 'go run ./api/openrpc/cmd miner') caused
the example logic to panic because some types
were missing.

This commit adds those missing types, although
I'm not an expert in the API so I can't
suggest that the example values provided are
ideal or well representative.

Date: 2020-11-21 07:50:21-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build/openrpc/full.json,build/openrpc/miner.json: add build/openrpc/[full/miner].json docs

These will be used as static documents
provided by the rpc.discover method.

Date: 2020-11-21 07:51:39-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build: init go-rice openrpc static assets

Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main: remove rpc.discover implementation from runtime plugin

Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel https://github.com/filecoin-project/lotus/pull/4711#pullrequestreview-535686205
This removes the runtime implementation from the
RPC server construction.

Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api,apistruct,common: add Discover(ctx) method to CommonAPI interface and structs

Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main: use rpc server method aliasing for rpc.discover

This depends on a currently-forked change at
filecoin-project/go-jsonrpc 8350f9463ee451b187d35c492e32f1b999e80210
which establishes this new method RPCServer.AliasMethod.

This solves the problem that the OpenRPC
spec says that the document should be served
at the system extension-prefixed endpoing
rpc.discover (not Filecoin.Discover).

In fact, the document will be available at BOTH
endpoints, but that duplicity is harmless.

Date: 2020-11-21 09:18:26-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api,apistruct,build,common: rpc.discover: return json object instead of string

Instead of casting the JSON asset from bytes to string,
unmarshal it to a map[string]interface{} so the
server will provide it as a JSON object.

Date: 2020-11-21 09:27:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* Makefile: merge resolve: docsgen command path

Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* apistruct,main,docgen,openrpc: merge resolve: fix func exporteds, signatures

Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: 'get get' auto-bumps version

Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* Makefile,docgen,main,build/openrpc: refactor openrpc documentation generation

This creates Makefile command docsgen-openrpc-json,
and refactors the docsgen command to generate both
the markdown and openrpc json documents, redirecting
the output of the openrpc json documentation to
the build/openrpc/ directory, where those json
files will be compiled as static assets via go-rice
boxes.

The api/openrpc/cmd now uses usage argumentation
congruent to that of the docgen command (switching
on API context).

Date: 2020-11-22 08:01:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main,docgen_openrpc: rename api/openrpc -> api/docgen-openrpc

Renames the package as well.

This is intended to parallel the
existing docgen package and command
namespacing.

Date: 2020-11-22 10:34:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api,apistruct,docgen,build,build/openrpc: use typed Discover response

Instead of using a map[string]interface{}, use
a typed response for the Discover method implementation.

This avoids having to set a docgen Example for
the generic map[string]interface{} (as an openrpc document)
which both pollutes the generic type and lacks
useful information for the Discover method example.

Date: 2020-11-22 08:31:16-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* apistruct,build,main,impl: implement Discover method for Worker and StorageMiner APIs

Methods return static compiled assets respective
to the APIs.

Date: 2020-11-22 08:57:18-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* docgen_openrpc,build/openrpc: remove timestamping from openrpc doc info

This should allow openrpc docs generated at different
times to be equal. This is important because the CI
(Circle) runs the docgen command and tests that
the output and the source are unchanged (via git diff).

Date: 2020-11-22 10:47:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* main,docgen_openrpc,main,build: fix lint issues

Fixes goimports, staticcheck, golint issues.

Date: 2020-11-22 11:06:46-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* docgenopenrpc: fix: don't use an underscore in package name (golint)

Date: 2020-11-22 11:07:53-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.sum: fix: mod-tidy-check (run 'go mod tidy')

Date: 2020-11-22 11:09:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: bump filecoin-project/go-jsonrpc dep to latest

This version includes the necessary RPCServer.AliasMethod
method.

Date: 2020-11-23 12:16:15-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* Makefile,main,build,build/openrpc: init gzipped openrpc static docs

Date: 2020-11-24 06:15:06-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build: refactor gzip reading

Date: 2020-11-24 06:18:34-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build: add basic test for openrpc doc from static assets

Date: 2020-11-24 06:30:23-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build: handle reader Close error

This keeps the errcheck linter happy.

Date: 2020-11-24 06:33:14-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.sum: run 'go mod tidy'

Date: 2020-11-24 06:36:07-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: go mod tidy

Tidying up after resolving the merge conflicts
with master at go.mod

Date: 2020-11-24 06:40:45-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* go.mod,go.sum: bump filecoin-project/go-jsonrpc to latest

This is a repeat of 76e6fd2, since the latest merge
to master seems to have reverted this.

Date: 2020-11-24 06:42:30-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* docgenopenrpc,build/openrpc: remove method example pairings, improve schema examples

Removing method example pairings since they were
redundant to schema examples and were not
implemented well.

Improved schema examples by using the ExampleValue
method instead of the map lookup.
Made a note in the comment here that this is
not ideal, since we have to make a shortcut assumption
/workaround by using 'unknown' as the method name
and the typea as its own parent.

Luckily these values aren't heavily used by the
method logic.

Date: 2020-11-27 12:57:36-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* docgenopenrpc: use generic number jsonschema for number types

Previously used an integer schema assuming
hex encoding. It appears, based on review some
of the examples, that this may not be the case.

Obvioussly this schema could be more descriptive,
but just shooting for mostly likely to be
not wrong at this point.

Date: 2020-12-15 14:44:37-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* cmd/lotus,go.mod,go.sum: maybe fix straggling merge resolution conflicts

Date: 2021-01-19 12:30:42-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* build/openrpc/full.json.gz,build/openrpc/miner.json.gz,build/openrpc/worker.json.gz: run 'make docsgen'

Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api/apistruct,node/impl: (lint) gofmt

Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api/docgen: maybe fix parse error:  open ./api: no such file or directory

Date: 2021-01-19 12:52:04-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api/docgen,build/openrpc: maybe fix no such file error and run 'make docsgen'

Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api/docgen: return if AST comment/groupdoc parsing encounters any error

This will returns empty comments/docs maps.
This should fix issues like:
https://app.circleci.com/pipelines/github/filecoin-project/lotus/12445/workflows/4ebadce9-a298-4ad1-939b-f19ef4c0a5bf/jobs/107218

where the environment makes file lookups hard or
impossible.

Date: 2021-01-19 13:04:58-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* api: Don't depend on build/

* make: support parallel docsgen

* openrpc gen: Use simple build version

* methodgen

* goimports

Co-authored-by: meows <b5c6@protonmail.com>
2021-03-19 19:22:46 +01:00

167 lines
7.6 KiB
Modula-2

module github.com/filecoin-project/lotus
go 1.15
require (
contrib.go.opencensus.io/exporter/jaeger v0.1.0
contrib.go.opencensus.io/exporter/prometheus v0.1.0
github.com/BurntSushi/toml v0.3.1
github.com/GeertJohan/go.rice v1.0.0
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/alecthomas/jsonschema v0.0.0-20200530073317-71f438968921
github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07
github.com/coreos/go-systemd/v22 v22.1.0
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e
github.com/dgraph-io/badger/v2 v2.2007.2
github.com/docker/go-units v0.4.0
github.com/drand/drand v1.2.1
github.com/drand/kyber v1.1.4
github.com/dustin/go-humanize v1.0.0
github.com/elastic/go-sysinfo v1.3.0
github.com/elastic/gosigar v0.12.0
github.com/etclabscore/go-openrpc-reflect v0.0.36
github.com/fatih/color v1.9.0
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f
github.com/filecoin-project/go-address v0.0.5
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 // indirect
github.com/filecoin-project/go-bitfield v0.2.4
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
github.com/filecoin-project/go-data-transfer v1.2.7
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a
github.com/filecoin-project/go-fil-markets v1.1.9
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec
github.com/filecoin-project/go-multistore v0.0.3
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200701152213-3e0f0afdc261
github.com/filecoin-project/go-state-types v0.1.0
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe
github.com/filecoin-project/go-statestore v0.1.1-0.20210311122610-6c7a5aedbdea
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
github.com/filecoin-project/specs-actors v0.9.13
github.com/filecoin-project/specs-actors/v2 v2.3.4
github.com/filecoin-project/specs-actors/v3 v3.0.3
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506
github.com/filecoin-project/test-vectors/schema v0.0.5
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
github.com/go-kit/kit v0.10.0
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang/mock v1.4.4
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.4
github.com/gorilla/websocket v1.4.2
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/golang-lru v0.5.4
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
github.com/ipfs/bbloom v0.0.4
github.com/ipfs/go-bitswap v0.3.2
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-blockservice v0.1.4
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-cidutil v0.0.2
github.com/ipfs/go-datastore v0.4.5
github.com/ipfs/go-ds-badger2 v0.1.1-0.20200708190120-187fc06f714e
github.com/ipfs/go-ds-leveldb v0.4.2
github.com/ipfs/go-ds-measure v0.1.0
github.com/ipfs/go-ds-pebble v0.0.2-0.20200921225637-ce220f8ac459
github.com/ipfs/go-filestore v1.0.0
github.com/ipfs/go-fs-lock v0.0.6
github.com/ipfs/go-graphsync v0.6.0
github.com/ipfs/go-ipfs-blockstore v1.0.3
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-ds-help v1.0.0
github.com/ipfs/go-ipfs-exchange-interface v0.0.1
github.com/ipfs/go-ipfs-exchange-offline v0.0.1
github.com/ipfs/go-ipfs-files v0.0.8
github.com/ipfs/go-ipfs-http-client v0.0.5
github.com/ipfs/go-ipfs-routing v0.1.0
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.5
github.com/ipfs/go-ipld-format v0.2.0
github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4
github.com/ipfs/go-merkledag v0.3.2
github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-metrics-prometheus v0.0.2
github.com/ipfs/go-path v0.0.7
github.com/ipfs/go-unixfs v0.2.4
github.com/ipfs/interface-go-ipfs-core v0.2.3
github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d
github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018
github.com/kelseyhightower/envconfig v1.4.0
github.com/lib/pq v1.7.0
github.com/libp2p/go-buffer-pool v0.0.2
github.com/libp2p/go-eventbus v0.2.1
github.com/libp2p/go-libp2p v0.12.0
github.com/libp2p/go-libp2p-connmgr v0.2.4
github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p-discovery v0.5.0
github.com/libp2p/go-libp2p-kad-dht v0.11.0
github.com/libp2p/go-libp2p-mplex v0.3.0
github.com/libp2p/go-libp2p-noise v0.1.2
github.com/libp2p/go-libp2p-peerstore v0.2.6
github.com/libp2p/go-libp2p-pubsub v0.4.2-0.20210212194758-6c1addf493eb
github.com/libp2p/go-libp2p-quic-transport v0.9.0
github.com/libp2p/go-libp2p-record v0.1.3
github.com/libp2p/go-libp2p-routing-helpers v0.2.3
github.com/libp2p/go-libp2p-swarm v0.3.1
github.com/libp2p/go-libp2p-tls v0.1.3
github.com/libp2p/go-libp2p-yamux v0.4.1
github.com/libp2p/go-maddr-filter v0.1.0
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/mitchellh/go-homedir v1.1.0
github.com/multiformats/go-base32 v0.0.3
github.com/multiformats/go-multiaddr v0.3.1
github.com/multiformats/go-multiaddr-dns v0.2.0
github.com/multiformats/go-multibase v0.0.3
github.com/multiformats/go-multihash v0.0.14
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/open-rpc/meta-schema v0.0.0-20201029221707-1b72ef2ea333
github.com/opentracing/opentracing-go v1.2.0
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a
github.com/prometheus/client_golang v1.6.0
github.com/raulk/clock v1.1.0
github.com/raulk/go-watchdog v1.0.1
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.0
github.com/urfave/cli/v2 v2.2.0
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2
github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542
go.etcd.io/bbolt v1.3.4
go.opencensus.io v0.22.5
go.uber.org/dig v1.10.0 // indirect
go.uber.org/fx v1.9.0
go.uber.org/multierr v1.6.0
go.uber.org/zap v1.16.0
golang.org/x/net v0.0.0-20201022231255-08b38378de70
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.28
gotest.tools v2.2.0+incompatible
honnef.co/go/tools v0.0.1-2020.1.3 // indirect
)
replace github.com/filecoin-project/lotus => ./
replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0
replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
replace github.com/filecoin-project/test-vectors => ./extern/test-vectors