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

WIP: Feat/openrpc describe #66

Closed
wants to merge 117 commits into from
Closed
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
c0b3e99
rpc: a way to describe openrpc doc vs. actual api methods
meowsbits Mar 12, 2020
e1e296f
rpc: return more information abound under methods
meowsbits Mar 12, 2020
2f27d7d
rpc: change method to dedupe, and instead read from file
meowsbits Mar 12, 2020
c4cdb5d
openrpc.json: include current ethereum-json-rpc-specification documen…
meowsbits Mar 12, 2020
70606a3
: include script for developing openrpc document
meowsbits Mar 12, 2020
b717463
: initial results for openrpc development feedback tools
meowsbits Mar 12, 2020
3d135fb
: use pretty printing and sorted Over lists
meowsbits Mar 12, 2020
f71a118
: revise further with hopefully improved/simplified alphabetization s…
meowsbits Mar 12, 2020
affbfe9
openrpc: remove eth_submitHashrate
meowsbits Mar 12, 2020
7cbfe11
openrpc: add admin_addPeer
meowsbits Mar 12, 2020
7fe19af
openrpc: add admin_addTrustedPeer
meowsbits Mar 12, 2020
12fcc73
openrpc: add admin_datadir
meowsbits Mar 12, 2020
97e4bbd
develop-openrpc-doc.sh: exit early if openrpc doc as edited isn't valid
meowsbits Mar 12, 2020
5174a59
WIP: rpc api describing with runtime, ast
meowsbits Mar 13, 2020
480c0ff
rpc: getting closer to openrpc schema for under list
meowsbits Mar 13, 2020
9c1fd41
:hammer:
meowsbits Mar 14, 2020
3655474
:hammer:
meowsbits Mar 14, 2020
25ffa84
WIP: tests and refactoring Describe
meowsbits Mar 15, 2020
f8badf7
install alecthomas.jsonschema for cd schemas
meowsbits Mar 15, 2020
62e3a8e
:floppy_disk:
meowsbits Mar 15, 2020
ae7f91f
:floppy_disk:
meowsbits Mar 15, 2020
6b1733d
WIP: was wrestling with nil-as-oneof but i'm buggy
meowsbits Mar 16, 2020
2d532e0
wip: rpc_describe returns doc
meowsbits Mar 16, 2020
f7e35ee
run cat rpc_describe.log | jj -p 'result' > ethereum-json-rpc.json
meowsbits Mar 16, 2020
122fc85
use external links instead of description
meowsbits Mar 16, 2020
11bfcc0
add ServerWithListener fn so server can self-describe
meowsbits Mar 16, 2020
452a4b9
server description from provider program name, version
meowsbits Mar 16, 2020
d7021d2
experiments with ethapi structs, fixes TraceTransaction return type
meowsbits Mar 16, 2020
e1354ed
.develop/openrpc-validator-cli.js,.develop/spec.json,.develop/test.sh…
meowsbits Mar 27, 2020
e3ba54c
p2p,rpc: (lint) goimports
meowsbits Mar 27, 2020
e634b09
.gitmodules: make go-openrpc development version remote
meowsbits Mar 27, 2020
4e0ebde
.develop/test.sh: fixup test script
meowsbits Mar 27, 2020
22f93fe
.develop/test.sh: fixup test script
meowsbits Mar 27, 2020
abd8920
.develop/test.sh: fixup test script
meowsbits Mar 27, 2020
9b77c07
:hammer:
meowsbits Mar 28, 2020
6e89095
:hammer:
meowsbits Mar 28, 2020
44f5bad
.develop/spec.json,.develop/spec1.json,.develop/spec2.json,rpc: passe…
meowsbits Mar 29, 2020
bfc4b52
:hammer:
meowsbits Mar 29, 2020
a60324a
:floppy_disk:
meowsbits Mar 29, 2020
78899d8
.develop/spec2.json,rpc: maybe have deferencing too
meowsbits Mar 29, 2020
ea7f356
.develop/spec.json,.develop/spec2.json,rpc: closer than ever
meowsbits Mar 29, 2020
8b0f697
rpc: remove dead code and dead comments
meowsbits Mar 29, 2020
8f8753c
go-openrpc: update go-openrpc submodule
meowsbits Mar 29, 2020
cee881a
.develop/spec.json,.develop/spec2.json,rpc: :bookmark: it passes
meowsbits Mar 29, 2020
6295542
.develop/spec.json,ethapi,rpc: messing around with EthSyncing, trying…
meowsbits Mar 30, 2020
ca80acf
rpc: fix typo
meowsbits Mar 30, 2020
8c24416
.gitmodules,jsonschema: develop fork of jsonschema lib
meowsbits Mar 30, 2020
4953b7c
.develop/serve.py,.develop/spec.json,go.mod,ethapi,jsonschema,rpc: st…
meowsbits Mar 30, 2020
e33b389
.develop/spec.json,rpc: re-enable 'cleaned' openrpc document
meowsbits Mar 30, 2020
2ce5ce2
ethapi,rpc: (lint) goimports, govet, gosimple
meowsbits Mar 30, 2020
5761cf4
rpc: update test callbacks count to actual
meowsbits Mar 30, 2020
b9d9f0b
.develop/spec2.json: update test output
meowsbits Mar 30, 2020
769edf9
rpc: add test for cyclical graph, fail
meowsbits Mar 31, 2020
38662b0
:hammer:
meowsbits Mar 31, 2020
beba177
:floppy_disk:
meowsbits Mar 31, 2020
ed3ac24
:hammer:
meowsbits Mar 31, 2020
d8028d7
:hammer:
meowsbits Mar 31, 2020
f9a5859
:hammer:
meowsbits Mar 31, 2020
295b2d8
:hammer:
meowsbits Mar 31, 2020
5ccb751
jst: clean up
meowsbits Apr 1, 2020
253fa8d
go.mod,go.sum,jst: initial mocking for TestTraverse
meowsbits Apr 1, 2020
5971264
jst: logs, set tests to pass
meowsbits Apr 1, 2020
274fac0
jst: debugging, refactor Traverse to look like the typescript orig
meowsbits Apr 1, 2020
b720b7a
jst: refactor Traverse test cases to use mutate/expect design
meowsbits Apr 1, 2020
99d302e
:hammer:
meowsbits Apr 2, 2020
a0c597d
:floppy_disk:
meowsbits Apr 2, 2020
cf1f0f5
jst: clean up dead and commented code
meowsbits Apr 2, 2020
bdc0bd8
:floppy_disk:
meowsbits Apr 2, 2020
c0917ff
:hammer:
meowsbits Apr 2, 2020
3cf2d23
jst,rpc: abstract test traverse options logic
meowsbits Apr 2, 2020
d24e681
:hammer:
meowsbits Apr 2, 2020
8108b02
i actually think uniquenodes option should not be an option
meowsbits Apr 2, 2020
10b3f22
:floppy_disk:
meowsbits Apr 3, 2020
1d5def1
jst: notes, clean
meowsbits Apr 3, 2020
f85fd0e
:hammer:
meowsbits Apr 3, 2020
1e06ba9
go.mod,go.sum: go mod tidy
meowsbits Apr 3, 2020
8fb93b5
jst: few more tests and logs, pretty stable
meowsbits Apr 3, 2020
c281025
jst,rpc: init refactoring
meowsbits Apr 3, 2020
010205a
.develop/spec.json,ethapi,jst,rpc: continue cleanup, fixes oneof issu…
meowsbits Apr 3, 2020
b5505da
go.mod,go.sum: maybe go mod tidy
meowsbits Apr 3, 2020
6abf651
.develop/spec.json,scwallet,jsonschema,rpc: hacky workarounds for mis…
meowsbits Apr 3, 2020
d5c4aea
jsonschema: bump jsonschema to latest
meowsbits Apr 3, 2020
27de8aa
.develop/spec.json,rpc: run test
meowsbits Apr 3, 2020
e2f26b6
jst,rpc: (lint) goimports
meowsbits Apr 3, 2020
76dc2b8
.develop/spec.json,jst,rpc: fixes rpc.BlockNumberOrHash type...
meowsbits Apr 3, 2020
f36393a
jsonschema: bump jsonschema
meowsbits Apr 4, 2020
044c8a2
.develop/spec.json,node,openrpc,rpc,rpc: init big refactoring to make…
meowsbits Apr 4, 2020
532614c
go.sum,openrpc,rpc: refactoring openrpc stuff out
meowsbits Apr 4, 2020
7af048e
go.mod,go.sum: go mod updates for removed jsonschema-traverse package
meowsbits Apr 4, 2020
75e1cb0
:hammer:
meowsbits Apr 9, 2020
8b73b9a
.gitmodules,go-openrpc: remote go-openrpc as submodule, we'll use as …
meowsbits Apr 9, 2020
ccdf168
go.mod: update to use fork
meowsbits Apr 9, 2020
47f4b5a
go.sum,openrpc,rpc: begin reorg
meowsbits Apr 9, 2020
b61bfa1
rpc: checkout foundation/master -- rpc
meowsbits Apr 9, 2020
c1f79d7
main,go.mod,go.sum,graphql,node,openrpc,rpc: chechout node, graphql, …
meowsbits Apr 9, 2020
9a1451c
.gitmodules,jsonschema: remove extraced submodule jsonschema
meowsbits Apr 9, 2020
3c2b9ac
go.mod,go.sum: update jsonschema fork imports
meowsbits Apr 9, 2020
1dd15d1
openrpc,rpc: init openrpc discover impl
meowsbits Apr 9, 2020
9127410
.develop/spec.json,.develop/test.sh,go.mod,rpc: init working impl
meowsbits Apr 9, 2020
fb5b231
: remove disused openrpc static files
meowsbits Apr 9, 2020
9568648
main: update to new rpc/node pattern
meowsbits Apr 9, 2020
692713b
rpc: (lint:deadcode) remote newGzipHandler
meowsbits Apr 9, 2020
e4c4725
ethapi: lint:goimports
meowsbits Apr 9, 2020
23bdc9c
.golangci.yml,rpc: lint:deadcode add rpc case to ignored issues
meowsbits Apr 9, 2020
600c206
go.mod,go.sum: bump openrpc dependency versions
meowsbits Apr 9, 2020
49c45f3
Merge branch 'master' into feat/openrpc-describe
meowsbits Apr 9, 2020
5d263c2
.develop/spec.json,go.mod,go.sum: update go-openrpc-reflect, improvin…
meowsbits Apr 9, 2020
5319e62
.develop/spec.json,rpc: provide type to schema map for more hexutil t…
meowsbits Apr 9, 2020
43180ab
.develop/spec.json,go.mod,go.sum: bump go-openrpc-reflect dependency …
meowsbits Apr 9, 2020
8843b93
.develop/spec.json,.develop/test.sh,rpc: register rpc.discover method…
meowsbits Apr 9, 2020
dfce94c
.develop/spec.json,node,rpc: refactor openrpc registry to node/ (out …
meowsbits Apr 10, 2020
a4188bf
main,node: move openrpc descriptor service to each handler
meowsbits Apr 10, 2020
6aad7c6
.develop/spec.json,go.mod,node: remove redundant zeroed instances in …
meowsbits Apr 10, 2020
fb5a231
node,params: lint:goimports
meowsbits Apr 10, 2020
7b72230
go.mod,go.sum: bump go-openrpc-reflect v0.0.20
meowsbits Apr 10, 2020
4af7b8b
node: fix node stack name -> Core-Geth
meowsbits Apr 10, 2020
492dae1
bind: feature to keep the bind test 'replace' dependencies 1:1 with r…
meowsbits Apr 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions .develop/openrpc-validator-cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

Choose a reason for hiding this comment

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

is this the result of running typescript compile?

If so, might I suggest that you include the src ts instead of the compiled result?

If this is meant to be maintained as JS, then lets ditch the export and clean this up a little.

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted. This is/was only in the PR as a shortcut/convenience for reproducing the document validation heuristic, and I've since made the script just demand that this tool is installed globally.

var schema_utils_js_1 = require("@open-rpc/schema-utils-js");
var program = require('commander').program;
program.version("0.0.1");
program.option("-v, --verbose", "verbose logging");
program.parse(process.argv);
// Get either stdin or first argument.
// https://gist.github.com/ishu3101/9fa58ca1440f780d6288
var args = program.args; // process.argv.slice(2);
var input = args[0];
var isTTY = process.stdin.isTTY;
var stdin = process.stdin;
var stdout = process.stdout;
// If no STDIN and no arguments, display usage message
if (isTTY && args.length === 0) {
program.help();
}
// If no STDIN but arguments given
else if (isTTY && args.length !== 0) {
handleShellArguments();
}
// read from STDIN
else {
handlePipedContent();
}
function handlePipedContent() {
var data = '';
stdin.on('readable', function () {
var chuck = stdin.read();
if (chuck !== null) {
data += chuck;
}
});
stdin.on('end', function () {
doValidate(data);
});
}
function handleShellArguments() {
doValidate(input);
}
function doValidate(input) {
if (input === "") {
process.exit(2);
}
schema_utils_js_1.parseOpenRPCDocument(input).then(function (doc) {
if (program.verbose)
console.log(doc);
console.log("OK");
}).catch(function (err) {
console.log("PARSE FAIL", err);
process.exit(1);
});
}
61 changes: 61 additions & 0 deletions .develop/serve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import SimpleHTTPServer

Choose a reason for hiding this comment

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

why add the python dep?

heres a popular one: https://www.npmjs.com/package/serve

Copy link
Member Author

Choose a reason for hiding this comment

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

This is here so I can serve the generated doc to a local Open-RPC playground for development visibility. I was getting CORS errors with the normal SimpleHTTPServer on Firefox otherwise.

import sys

# https://gist.github.com/enjalot/2904124
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
None, in which case the caller has nothing further to do.
"""
path = self.translate_path(self.path)
f = None
if os.path.isdir(path):
if not self.path.endswith('/'):
# redirect browser - doing basically what apache does
self.send_response(301)
self.send_header("Location", self.path + "/")
self.end_headers()
return None
for index in "index.html", "index.htm":
index = os.path.join(path, index)
if os.path.exists(index):
path = index
break
else:
return self.list_directory(path)
ctype = self.guess_type(path)
try:
# Always read in binary mode. Opening files in text mode may cause
# newline translations, making the actual size of the content
# transmitted *less* than the content-length!
f = open(path, 'rb')
except IOError:
self.send_error(404, "File not found")
return None
self.send_response(200)
self.send_header("Content-type", ctype)
fs = os.fstat(f.fileno())
self.send_header("Content-Length", str(fs[6]))
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
self.send_header("Access-Control-Allow-Origin", "*")
self.end_headers()
return f


if __name__ == "__main__":
import os
import SocketServer

PORT = (len(sys.argv) > 1 and int(sys.argv[1])) or 31338

Handler = CORSHTTPRequestHandler
#Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()