-
Notifications
You must be signed in to change notification settings - Fork 999
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
Local Graph node debug tool using a remote GraphQL endpoint (per LimeChain) #2995
Conversation
I see there are a lot of changes in the imports (ordering, position, etc), is this being by your IDE somehow? |
Actually those changes were not made by me, so I am not sure. They are coming from 9b0cdcf. Judging by the commit message, I suppose they are caused by cc: @axiomatic-aardvark |
@VIVelev I don't think it's Or if is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR! I commented on suggestions and required changes 🙂
core, node, server, store: fix issues from removed debug_endpoint runtime: cargo and host
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @VIVelev thanks for fixing the issues and restructuring your PR ❤️
I'm really sorry it took so long to look over it again.
The only two points I'm not 100% sure about are:
- If the
Mutex
is the best way to handle the already saved/fetched ids - I see that you just pass a
DeploymentHash
through thegraph-cli
(graph deploy
, CLI PR for reference) and no block number like grafting. Even though it makes sense in the scenario of a failing subgraph because the block number will be the last one (the one that failed), if someone wants to debug-fork for some reason in a different point in time, this PR doesn't allow that. I think you could add this for better flexibility of the feature.
But before changing any of the two points above, I would like to know @Jannis opinion 😊
client: reqwest::Client, | ||
endpoint: Url, | ||
schema: Arc<Schema>, | ||
fetched_ids: Mutex<HashSet<String>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of the fetching mechanism seems correct, @Jannis do you see any problem with using a Mutex
here? 🤔
@@ -170,6 +170,32 @@ impl TryFrom<q::Value> for Value { | |||
} | |||
} | |||
|
|||
impl From<serde_json::Value> for Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why there's the need for two Value
s in the fork.rs
file, is this really needed or could we just do one JSON transformation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field types supported by serde_json::Value
and the Value
used in the subgraph store are different, so there needs to be a mechanism in which to convert from one to the other. The above Value
and the From<serde_json::Value>
provide this mechanism.
Regarding |
#2414 likely generated conflicts for this, lmk if you have issues when rebasing. |
It's all good now :) |
This PR implements the Debug Tool discussed with LimeChain.
What is it?
A way to debug your failed subgraph at block X without needing to wait to sync up to block X.
How it is done?
It uses a remote Graph node GraphQL endpoint that is guaranteed to have the subgraph indexed up to block X in order to provide the locally-deployed subgraph being debugged a synced-up store.
What changes have been made?
runtime/wasm/src/module/mod.rs
has been changed to resort to the endpoint when needed.subgraphs.subgraph_manifest
PostgreSQL table has been altered to include adebug_endpoint
string, nullable column to store the endpoint's address.SubgraphStore
trait and related have been modified to enable easy retrieval ofdebug_endpoint
when needed. (most prominently a new method get_debug_endpoint has been added)graph debug
SubgraphRegistrar
's create_subgraph_version has been altered to accommodate the 2 new params:debug_endpoint
anddebug_block_number
.Points to discuss
create_subgraph_version
be split into 2 separate functions - one for deploy only and one for debug only?