Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenRPC Support #5843

Merged
merged 61 commits into from
Mar 19, 2021
Merged

OpenRPC Support #5843

merged 61 commits into from
Mar 19, 2021

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Mar 19, 2021

This some remaining issues with #4711, should be mergable in this shape now to unblock more V1 API work

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

Signed-off-by: meows <[email protected]>
This is for development only.
Versions need to be bumped when they're ready for use
as canonical remotes.

Signed-off-by: meows <[email protected]>
This eliminates code duplication.

Signed-off-by: meows <[email protected]>
Also fixes casing stuff for the rest of Filecoin.
methods.

Signed-off-by: meows <[email protected]>
This fixes an issue caused with the latest reverting
commit.

Signed-off-by: meows <[email protected]>
…orted stuff

Signed-off-by: meows <[email protected]>

Makefile: fix docgen refactoring for makefile use of command

Signed-off-by: meows <[email protected]>
There are quite of few of these already registered
for the docgen command, so it makes sense to use
those!

Signed-off-by: meows <[email protected]>
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 <[email protected]>
…flect

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
#4711 (review)

Date: 2020-11-21 06:52:48-06:00
Signed-off-by: meows <[email protected]>
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
Date: 2020-11-21 08:23:06-06:00
Signed-off-by: meows <[email protected]>
Instead of generating the doc on the fly,
we're going to serve a static asset.
Rel #4711 (review)
This removes the runtime implementation from the
RPC server construction.

Date: 2020-11-21 08:41:20-06:00
Signed-off-by: meows <[email protected]>
… and structs

Date: 2020-11-21 08:41:56-06:00
Signed-off-by: meows <[email protected]>
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 <[email protected]>
…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 <[email protected]>
Conflicts:
      Makefile
      api/api_common.go
      api/apistruct/struct.go
      api/docgen/docgen.go
      go.mod
      go.sum
Date: 2020-11-22 07:19:36-06:00
Signed-off-by: meows <[email protected]>
…natures

Date: 2020-11-22 07:31:03-06:00
Signed-off-by: meows <[email protected]>
Date: 2020-11-22 07:31:44-06:00
Signed-off-by: meows <[email protected]>
…neration

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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
Conflicts:
	api/apistruct/struct.go
	api/docgen/docgen.go
	cmd/lotus/rpc.go
	go.mod
	go.sum
	node/impl/storminer.go
…worker.json.gz: run 'make docsgen'

Date: 2021-01-19 12:33:55-06:00
Signed-off-by: meows <[email protected]>
Date: 2021-01-19 12:39:48-06:00
Signed-off-by: meows <[email protected]>
…docsgen'

Date: 2021-01-19 12:55:52-06:00
Signed-off-by: meows <[email protected]>
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 <[email protected]>
@magik6k magik6k requested a review from Kubuxu March 19, 2021 12:53
@magik6k magik6k requested a review from whyrusleeping as a code owner March 19, 2021 12:53
@Kubuxu
Copy link
Contributor

Kubuxu commented Mar 19, 2021

What are the two goros and goross files?

@magik6k
Copy link
Contributor Author

magik6k commented Mar 19, 2021

Those were the result of running go mod tidy and git add go*, fixed now

Copy link
Contributor

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGWM but IMO we should squash it due to non-building commits in the middle.

@magik6k magik6k merged commit 43d9cc3 into master Mar 19, 2021
@magik6k magik6k deleted the feat/openrpc branch March 19, 2021 18:22
@magik6k magik6k mentioned this pull request Mar 22, 2021
@magik6k magik6k mentioned this pull request Apr 13, 2021
69 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants