Skip to content

Comments

Initial GraphQL interface implementation#6821

Merged
AskAlexSharov merged 13 commits intoerigontech:develfrom
SLoeuillet:graphql
Feb 20, 2023
Merged

Initial GraphQL interface implementation#6821
AskAlexSharov merged 13 commits intoerigontech:develfrom
SLoeuillet:graphql

Conversation

@SLoeuillet
Copy link
Contributor

That's an initial PR mostly for code review, not ready for production use

Got basic GraphQL working when querying a single block

@SLoeuillet
Copy link
Contributor Author

GraphQL actually enabled if using --graphql but could be changed to use --http.api=graphql

To test it, go to
http://localhost:8545/graphql for request, /graphql/ui for user-friendly UI

A sample block query is bundled in the graphql/ subdirectory

@AskAlexSharov
Copy link
Collaborator

looks good. need port geth's tests also

@SLoeuillet
Copy link
Contributor Author

@AskAlexSharov : I'll try to add unit tests this week-end

Any preference for protocol activation ? (--graphql to mimic Geth) or via the "erigon standard" --http.api=graphql ?

@AskAlexSharov
Copy link
Collaborator

@AskAlexSharov : I'll try to add unit tests this week-end

Any preference for protocol activation ? (--graphql to mimic Geth) or via the "erigon standard" --http.api=graphql ?

Geth-compatible

@SLoeuillet SLoeuillet mentioned this pull request Feb 10, 2023
@SLoeuillet
Copy link
Contributor Author

Unit tests from geth imported and improved (tests via regexps, also tests chainID query)

@SLoeuillet
Copy link
Contributor Author

For Graphq tests to work, rpcdaemon have to be run with --graphql

--- FAIL: TestGraphQLQueryBlock (0.00s)
graph_test.go:106: could not post: Post "http://localhost:8545/graphql": dial tcp [::1]:8545: connect: connection refused
FAIL
FAIL github.com/ledgerwatch/erigon/cmd/rpcdaemon/graphql 0.216s
? github.com/ledgerwatch/erigon/cmd/rpcdaemon/graphql/graph [no test files]

@SLoeuillet SLoeuillet force-pushed the graphql branch 2 times, most recently from 59ad4e5 to 9342bc3 Compare February 14, 2023 11:21
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Feb 20, 2023
Merged via the queue into erigontech:devel with commit 195a72b Feb 20, 2023
@SLoeuillet
Copy link
Contributor Author

Thanks @AskAlexSharov

@AskAlexSharov
Copy link
Collaborator

@SLoeuillet

--- FAIL: TestGraphQLQueryBlock (0.00s)
graph_test.go:106: could not post: Post "http://localhost:8545/graphql": dial tcp [::1]:8545: connect: connection refused
FAIL

Let's turn this test to UnitTest. I don't see why we can't start graphql server inside test.
For example we have:
rpc/server_test.go
rpc/http_test.go

@SLoeuillet SLoeuillet deleted the graphql branch March 9, 2023 08:56
@s1na
Copy link
Contributor

s1na commented Mar 28, 2023

Hey I see you guys added basic support for GraphQL. I made a PR to change the schema slightly, basically enforcing every number (Int, Long or BigInt) to be formatted as hex. Feel free to chime in: ethereum/execution-apis#389

@SLoeuillet
Copy link
Contributor Author

Thanks @s1na. Would take a look

finiteops pushed a commit to bitfinity-network/erigon that referenced this pull request Apr 10, 2023
That's an initial PR mostly for code review, not ready for production
use

Got basic GraphQL working when querying a single block

---------

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
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